48 lines
1.0 KiB
YAML
48 lines
1.0 KiB
YAML
- name: Set up openvpn on remote node
|
|
package:
|
|
name: openvpn
|
|
state: present
|
|
become: true
|
|
|
|
- name: Copy openvpn config to remote node
|
|
copy:
|
|
src: ../templates/k3s_worker.ovpn
|
|
dest: /etc/openvpn/openvpn.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
become: true
|
|
|
|
- name: Setup autoconnect
|
|
lineinfile:
|
|
path: /etc/default/openvpn
|
|
line: AUTOSTART="all"
|
|
become: true
|
|
|
|
- name: Restart openvpn service
|
|
service:
|
|
name: openvpn
|
|
state: restarted
|
|
become: true
|
|
|
|
- name: Download k3s install script
|
|
get_url:
|
|
url: https://get.k3s.io
|
|
dest: /tmp/install-k3s.sh
|
|
mode: 0755
|
|
|
|
- name: Create k3s config file
|
|
template:
|
|
src: ../templates/config.yml.j2
|
|
dest: "/home/{{ ansible_user }}/k3s_config.yml"
|
|
|
|
- name: Only run uninstall script if it exists
|
|
become: true
|
|
shell: /usr/local/bin/k3s-uninstall.sh
|
|
args:
|
|
removes: /usr/local/bin/k3s-uninstall.sh
|
|
|
|
- name: Execute k3s install script providing a config.yml
|
|
shell: "/tmp/install-k3s.sh --config /home/{{ ansible_user }}/k3s_config.yml agent"
|
|
|