risotto/ansible/host.yml

60 lines
1.3 KiB
YAML
Raw Normal View History

2022-10-01 22:33:11 +02:00
---
- name: "Populate service facts"
service_facts:
- name: "Packages installation"
apt:
pkg: "{{ vars[inventory_hostname]['general']['host_packages'] }}"
update_cache: yes
state: latest
2023-01-23 20:23:32 +01:00
- name: "Host is modified"
include_tasks: host_modified.yml
when: build_host.host_changed
2022-10-01 22:33:11 +02:00
- name: "Copy machines scripts"
ansible.builtin.copy:
src: "{{ item }}"
dest: "/usr/local/sbin"
owner: "root"
group: "root"
mode: "0755"
2022-12-21 16:35:58 +01:00
loop: "{{ lookup('fileglob', 'sbin/*', wantlist=True) | list }}"
2022-10-01 22:33:11 +02:00
- name: "Remove dest images files"
file:
path: /var/lib/risotto/images_files
2023-01-23 20:23:32 +01:00
state: "{{ item }}"
2022-10-01 22:33:11 +02:00
mode: "0700"
2023-01-23 20:23:32 +01:00
with_items:
- absent
- directory
2022-10-01 22:33:11 +02:00
- name: "Copy images files"
unarchive:
2023-01-23 20:23:32 +01:00
remote_src: true
src: "/tmp/new_configurations/images_files.tar"
2022-10-01 22:33:11 +02:00
dest: "/var/lib/risotto/images_files"
2022-12-21 16:35:58 +01:00
- name: "Create versions directory"
file:
2023-01-23 20:23:32 +01:00
path: /var/lib/risotto/machines_informations
2022-12-21 16:35:58 +01:00
state: directory
mode: "0700"
2023-01-23 20:23:32 +01:00
- name: "Empty tests files"
file:
path: /var/lib/risotto/tests
state: "{{ item }}"
mode: "0700"
with_items:
- absent
- directory
- name: "Copy tests files"
unarchive:
remote_src: true
src: "/tmp/new_configurations/tests.tar"
dest: "/var/lib/risotto/tests"
when: copy_tests