-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
49 lines (36 loc) · 1.24 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
# This Playbook installs requirements and Compose OSTree, Performs SSH Setup and Rebase on Own OSTree
- name: Main Playbook
hosts: localhost
become: yes
become_method: sudo
tasks:
- include: create-vm.yml
- include: compose.yml
- name: Wait for 10s to retrieve the IP
wait_for:
timeout: 10
- name: Retrieve the IP
shell: virsh domifaddr atomic-node | tail -2| awk '{print $4}' | cut -d/ -f1
register: vm_ip
- debug: msg="{{ vm_ip.stdout }}"
- name: Retrieve Absolute path for SSH public key
shell: getent passwd 1000 | cut -d {{':'}} -f 6
register: abs_dest
- name: ssh-copy-id to the Atomic host
shell: ssh-copy-id -i "{{ abs_dest.stdout }}"/.ssh/id_rsa.pub atomic-user@$"{{ vm_ip.stdout }}"
- name: Add IP to atomichost group
add_host: hostname="{{ vm_ip.stdout }}" groupname=atomichost ansible_ssh_user=atomic-user
- name: Rebase OSTree
hosts: atomichost
become: yes
become_method: sudo
vars_files:
- vars/atomic.yml
tasks:
- name: Create remote named {{ atomicname }}
command:
ostree remote add "{{ atomicname }}" http://"{{ httpserver }}":35000/repo --no-gpg-verify
- name: Rebase on my tree
command:
rpm-ostree rebase "{{ atomicname }}":"{{ basehost }}"