mirror of
https://github.com/DO1JLR/ansible_linux_desktop_setup.git
synced 2024-09-14 19:54:51 +02:00
update openvpn
This commit is contained in:
parent
1fbcc6bdfd
commit
9dd5bc1973
3 changed files with 35 additions and 30 deletions
|
@ -1,16 +1,18 @@
|
||||||
---
|
---
|
||||||
|
- name: perform versionscheck
|
||||||
|
ansible.builtin.include_tasks: versioncheck.yml
|
||||||
|
|
||||||
- name: Run the equivalent of "pacman -Syu" as a separate step
|
- name: Run the equivalent of "pacman -Syu" as a separate step
|
||||||
become: yes
|
become: true
|
||||||
pacman:
|
ansible.builtin.pacman:
|
||||||
update_cache: yes
|
update_cache: true
|
||||||
upgrade: yes
|
upgrade: true
|
||||||
when: ansible_os_family == 'Archlinux'
|
when: ansible_os_family == 'Archlinux'
|
||||||
|
|
||||||
- name: Install OpenVPN for ArchLinux
|
- name: Install OpenVPN for ArchLinux
|
||||||
become: yes
|
become: true
|
||||||
pacman:
|
ansible.builtin.pacman:
|
||||||
name:
|
name:
|
||||||
- openvpn
|
- openvpn
|
||||||
- bridge-utils
|
- bridge-utils
|
||||||
- easy-rsa
|
- easy-rsa
|
||||||
|
@ -18,9 +20,9 @@
|
||||||
when: ansible_os_family == 'Archlinux'
|
when: ansible_os_family == 'Archlinux'
|
||||||
|
|
||||||
- name: Install OpenVPN all
|
- name: Install OpenVPN all
|
||||||
become: yes
|
become: true
|
||||||
package:
|
ansible.builtin.package:
|
||||||
name:
|
name:
|
||||||
- openvpn
|
- openvpn
|
||||||
- bridge-utils
|
- bridge-utils
|
||||||
- easy-rsa
|
- easy-rsa
|
||||||
|
@ -28,14 +30,13 @@
|
||||||
when: ansible_os_family != 'Archlinux'
|
when: ansible_os_family != 'Archlinux'
|
||||||
|
|
||||||
- name: Add the tun module
|
- name: Add the tun module
|
||||||
become: yes
|
become: true
|
||||||
modprobe:
|
community.general.modprobe:
|
||||||
name: tun
|
name: tun
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add the bridge module
|
- name: Add the bridge module
|
||||||
become: yes
|
become: true
|
||||||
modprobe:
|
community.general.modprobe:
|
||||||
name: bridge
|
name: bridge
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,41 @@
|
||||||
---
|
---
|
||||||
- name: Create directory for versionscheck
|
- name: Create directory for versionscheck
|
||||||
become: true
|
become: true
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: '/etc/ansible-version'
|
path: '/etc/.ansible-version'
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0755
|
mode: 0755
|
||||||
when: submodules_versioncheck|bool
|
|
||||||
|
|
||||||
- name: check playbook version
|
- name: check playbook version
|
||||||
become: true
|
become: true
|
||||||
slurp:
|
ansible.builtin.slurp:
|
||||||
src: "{{ playbook_version_path }}"
|
src: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
register: playbook_version
|
register: playbook_version
|
||||||
when: submodules_versioncheck|bool
|
ignore_errors: true
|
||||||
ignore_errors: yes
|
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: Print remote role version
|
- name: Print remote role version
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
msg: "Remote role version: {{ playbook_version.content | default('Y3VycmVudGx5IG5vdCBkZXBsb3llZAo=') | b64decode | string }}"
|
||||||
when: submodules_versioncheck|bool
|
|
||||||
|
|
||||||
- name: Print locale role version
|
- name: Print locale role version
|
||||||
debug:
|
ansible.builtin.debug:
|
||||||
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
msg: "Local role version: '{{ playbook_version_number|string }}'."
|
||||||
when: submodules_versioncheck|bool
|
|
||||||
|
|
||||||
- name: Check if your version is outdated
|
- name: Check if your version is outdated
|
||||||
fail:
|
ansible.builtin.fail:
|
||||||
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
msg: "Your ansible module has the version '{{ playbook_version_number }}' and is outdated. You need to update it!"
|
||||||
when:
|
when:
|
||||||
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
- playbook_version.content|default("Mgo=")|b64decode|int - 1 >= playbook_version_number|int and submodules_versioncheck|bool
|
||||||
|
|
||||||
|
- name: check if '/etc/ansible-version/' is empty
|
||||||
|
ansible.builtin.find:
|
||||||
|
paths: '/etc/ansible-version/'
|
||||||
|
register: filesFound
|
||||||
|
|
||||||
- name: write new version to remote disk
|
- name: write new version to remote disk
|
||||||
become: true
|
become: true
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ playbook_version_number }}"
|
content: "{{ playbook_version_number }}"
|
||||||
dest: "{{ playbook_version_path }}"
|
dest: "/etc/.ansible-version/{{ playbook_version_path }}"
|
||||||
when: submodules_versioncheck|bool
|
mode: '0644'
|
||||||
|
|
3
roles/openvpn/vars/main.yml
Normal file
3
roles/openvpn/vars/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
playbook_version_number: 1337
|
||||||
|
playbook_version_path: 'openvpn__random__4FWvXf4WPrjttnKnVPMzkXTtNVkz4Tg.version
|
Loading…
Reference in a new issue