2021-02-09 17:05:00 +01:00
|
|
|
---
|
|
|
|
# file: tasks/cloudinit.yml
|
|
|
|
|
|
|
|
- name: cloudinit - install cloud-init packages
|
2021-07-14 21:38:30 +02:00
|
|
|
when: hosts_cloudinit_enable|default(false) and ansible_os_family|lower != "alpine"
|
2021-02-09 17:05:00 +01:00
|
|
|
package: name="cloud-init" state="present"
|
|
|
|
become: yes
|
|
|
|
|
2022-01-09 17:32:54 +01:00
|
|
|
- name: cloudinit - install cloud-init packages - alpine
|
2021-07-14 21:38:30 +02:00
|
|
|
when: hosts_cloudinit_enable|default(false) and ansible_os_family|lower == "alpine"
|
|
|
|
with_items:
|
|
|
|
- { "name": "cloud-init", "state": "present" }
|
|
|
|
- { "name": "cloud-init-openrc", "state": "present" }
|
2021-02-09 17:05:00 +01:00
|
|
|
apk:
|
2021-06-16 13:19:52 +02:00
|
|
|
name: "{{ item.name}}"
|
|
|
|
state: "{{ item.state }}"
|
2021-02-09 17:05:00 +01:00
|
|
|
repository:
|
|
|
|
- http://dl-cdn.alpinelinux.org/alpine/edge/main
|
|
|
|
- http://dl-cdn.alpinelinux.org/alpine/edge/testing
|
|
|
|
- http://dl-cdn.alpinelinux.org/alpine/edge/community
|
|
|
|
- http://dl-cdn.alpinelinux.org/alpine/latest-stable/main
|
|
|
|
- http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
- name: cloudinit - update /etc/cloud/cloud.cfg
|
2021-07-14 21:38:30 +02:00
|
|
|
when: hosts_cloudinit_enable|default(false)
|
2021-02-09 17:05:00 +01:00
|
|
|
template:
|
2021-06-16 13:19:52 +02:00
|
|
|
src: cloud.cfg.j2
|
2021-02-09 17:05:00 +01:00
|
|
|
dest: /etc/cloud/cloud.cfg
|
|
|
|
force: yes
|
|
|
|
|
|
|
|
- name: cloudinit - activate service
|
2021-07-14 21:38:30 +02:00
|
|
|
when: hosts_cloudinit_enable|default(false) and ansible_service_mgr|lower != "openrc"
|
2021-02-09 17:05:00 +01:00
|
|
|
service:
|
|
|
|
name: cloud-init
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
become: yes
|
|
|
|
|
2022-01-09 17:32:54 +01:00
|
|
|
- name: cloudinit - activate service - openrc
|
2021-07-14 21:38:30 +02:00
|
|
|
when: hosts_cloudinit_enable|default(false) and ansible_service_mgr|lower == "openrc"
|
2021-02-09 17:05:00 +01:00
|
|
|
service:
|
|
|
|
name: cloud-init
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
runlevel: boot
|
|
|
|
become: yes
|
2021-07-14 21:38:30 +02:00
|
|
|
|