Dot_Files/tasks/install-lua.yml

82 lines
2.1 KiB
YAML
Raw Normal View History

2022-08-01 03:41:35 -05:00
---
- name: Check if Luajit is installed
ansible.builtin.command:
cmd: which luajit
register: luajit_installed
2022-08-01 03:44:26 -05:00
failed_when: luajit_installed.rc > 1
2022-08-01 03:41:35 -05:00
changed_when: false
- name: Set Luajit variables if not set
ansible.builtin.set_fact:
2022-08-01 03:46:29 -05:00
lua_jit_version: "{{ lua_jit_version | default('v2.0.5') }}"
2022-08-01 03:41:35 -05:00
lua_jit_git_dest: "{{ lua_jit_git_dest | default('/tmp/luajit') }}"
when: luajit_installed.rc != 0
- name: Get Luajit From Git
ansible.builtin.git:
2022-08-01 03:45:31 -05:00
repo: https://luajit.org/git/luajit.git
2022-08-01 03:41:35 -05:00
dest: "{{ lua_jit_git_dest }}"
version: "{{ lua_jit_version }}"
force: true
when: luajit_installed.rc != 0
- name: Install Luajit
become: true
ansible.builtin.shell: >
cd "{{ lua_jit_git_dest }}" &&
make &&
sudo make install
changed_when: true
when: luajit_installed.rc != 0
- name: Check if Lua is installed
ansible.builtin.command:
cmd: which lua
register: lua_installed
2022-08-01 03:44:26 -05:00
failed_when: lua_installed.rc > 1
2022-08-01 03:41:35 -05:00
changed_when: false
- name: Set Lua variables if not set
ansible.builtin.set_fact:
lua_version: "{{ lua_version | default('5.4.4') }}"
lua_dest: "{{ lua_dest | default('/tmp/lua') }}"
2022-08-01 04:13:38 -05:00
when: lua_installed.rc != 0
- name: Set Lua archive variable if not set
ansible.builtin.set_fact:
2022-08-01 03:41:35 -05:00
lua_dest_archive: "{{ lua_dest_archive | default(lua_dest + '/lua.tar.gz') }}"
when: lua_installed.rc != 0
2022-08-01 04:16:50 -05:00
- name: Create Lua extraction directory
ansible.builtin.file:
path: "{{ lua_dest }}"
state: directory
mode: 0755
2022-08-01 03:41:35 -05:00
- name: Download Lua
ansible.builtin.get_url:
url: http://www.lua.org/ftp/lua-{{ lua_version }}.tar.gz
dest: "{{ lua_dest_archive }}"
mode: 0644
when: lua_installed.rc != 0
- name: Extract Lua
ansible.builtin.unarchive:
src: "{{ lua_dest_archive }}"
dest: "{{ lua_dest }}"
when: lua_installed.rc != 0
- name: Compile Lua
ansible.builtin.command:
2022-08-01 04:18:33 -05:00
cmd: make
2022-08-01 03:41:35 -05:00
chdir: "{{ lua_dest }}"
changed_when: true
when: lua_installed.rc != 0
- name: Install Lua
ansible.builtin.command:
cmd: make install
chdir: "{{ lua_dest }}"
changed_when: true
when: lua_installed.rc != 0