diff --git a/.drone.yml b/.drone.yml index 3e72916..9335728 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,7 +26,10 @@ steps: sed -i -e "s/<>/$${SSH_PASSWORD}/g" \ packer/preseed/UbuntuServer20.04/user-data - | - yamllint -d "{extends: relaxed, rules: {line-length: disable}}" ansible packer/preseed/UbuntuServer20.04/user-data scripts + yamllint -d "{extends: relaxed, rules: {line-length: disable}}" \ + ansible \ + packer/preseed/UbuntuServer20.04/user-data \ + scripts - | packer init -upgrade \ ./packer diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 5cf18b5..997713c 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -4,3 +4,4 @@ become: true roles: - os + - firstboot diff --git a/ansible/roles/firstboot/files/firstboot.sh b/ansible/roles/firstboot/files/firstboot.sh new file mode 100644 index 0000000..e980c89 --- /dev/null +++ b/ansible/roles/firstboot/files/firstboot.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +# FOO \ No newline at end of file diff --git a/ansible/roles/firstboot/tasks/main.yml b/ansible/roles/firstboot/tasks/main.yml new file mode 100644 index 0000000..7573161 --- /dev/null +++ b/ansible/roles/firstboot/tasks/main.yml @@ -0,0 +1,12 @@ +- name: Copy firstboot script file + ansible.builtin.copy: + src: firstboot.sh + dest: /opt/firstboot.sh + owner: root + group: root + mode: o+x +- name: Create @reboot crontab job + ansible.builtin.cron: + name: "firstboot" + special_time: reboot + job: "/opt/firstboot.sh" \ No newline at end of file diff --git a/ansible/roles/os/tasks/cloud-init.yml b/ansible/roles/os/tasks/cloud-init.yml index 50f7b5f..ad1f4da 100644 --- a/ansible/roles/os/tasks/cloud-init.yml +++ b/ansible/roles/os/tasks/cloud-init.yml @@ -3,8 +3,6 @@ name: cloud-init state: absent purge: yes - # autoclean: yes - # autoremove: yes - name: Delete cloud-init files ansible.builtin.file: path: "{{ item }}" diff --git a/ansible/roles/os/tasks/network.yml b/ansible/roles/os/tasks/network.yml index 6f26e46..b17ad94 100644 --- a/ansible/roles/os/tasks/network.yml +++ b/ansible/roles/os/tasks/network.yml @@ -1,5 +1,5 @@ - name: Disable & mask networkd-wait-online ansible.builtin.systemd: name: systemd-networkd-wait-online - enable: no + enabled: no masked: yes diff --git a/ansible/roles/os/tasks/packages.yml b/ansible/roles/os/tasks/packages.yml index 971ade6..7030bbd 100644 --- a/ansible/roles/os/tasks/packages.yml +++ b/ansible/roles/os/tasks/packages.yml @@ -4,3 +4,12 @@ state: latest update_cache: yes loop: "{{ packages }}" +- name: Upgrade all packages + ansible.builtin.apt: + name: "*" + state: latest + update_cache: yes +- name: Cleanup + ansible.builtin.apt: + autoclean: yes + autoremove: yes diff --git a/ansible/vars/main.yml b/ansible/vars/main.yml index 08c4ce9..55f4a79 100644 --- a/ansible/vars/main.yml +++ b/ansible/vars/main.yml @@ -1,2 +1,3 @@ packages: - ansible + - libxml2-utils