Commit 2b3ff264 by Nicolas Wavrant

playbook: add re6stnet-upgrader playbook

1 parent 3258eb67
- name: a play that runs entirely on the ansible host
hosts: 127.0.0.1
connection: local
vars:
- computer_name: noname
- slapostoken: notoken
vars_files:
- settings/vifib.yml
roles:
- {role: re6stnet-upgrader}
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBE4cLroBEADpvqxw6SbNxQJVWVJKPSBF0zRKb4o3fM2OqJCcV5Uz888auonz
tOM7XU+d7Err6W0fO/Wa1GaK1VhlLF8QmjYU9xYrzgkFMu8BG6zqJD1Bqd3MSw24
THS1YAKf18ca4J5F2Bx9e6mC99GVSrX+MEAi6JH4U6/cC044jy//NnJqzSvWyUN1
dUAJ+fkw0KufzuqTZb4UnIMQjFPMzp6wm6GEF5/+UXvrzFPakeupcdzIrqdhyDUG
2S+9pb0uiVjoAvkSD4Q2PYD7RYq4qLio/LOkk9goA/Vw7ShqqQcN6X/IaJThg7e9
ibMj7Ba/4tscCPTOZUsQqtf0+Inj432j7DWxa6qxwzi9D50RJd/NI+lMHM0hib0h
FvfyJzIHOO6nI2ZVJy4+UuiK+L0ApZHQBx9CrRC08c4+jZw4SzADbdO6vyrg8wIH
P6Edy5NEO27SbcOed4ngD53SVR1GH8RCWLD6pLHEtKLW+mGdpoPqwKgEqwaALMBZ
K2YtJvQU5FGdYq9TvSEpIZEebpMVRLbfLnVjECwhrVolHRL3tcNjcwHz5eKVlAWx
74L6cLURUHGf7rxq4tD7RmBzWTWVRTV+G9Ib/U1RPITBpFWqH4zQyWq1jEF2oR3e
YaJEmK6SeFZwd+HCckpejMhekjcDo3oOs+F9xhhERBBx8ghaC2iYQ2P43QARAQAB
tCJKdWxpZW4gTXVjaGVtYmxlZCA8am1Aam11Y2hlbWIuZXU+iEYEEBECAAYFAk4c
MkgACgkQvfKiIF42GdNy4gCfephGu3hIT+43DJ1eXxkWjoBjdewAn2j7gRVyCXAj
ZYFAi2IJiu5fnzh6iEYEEBEIAAYFA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uISKi5XMV
1aAvA/4vyG9evJ6DlAxfd235t3LUsYSmzKa5/1Wv4bVfAQXism4oGS4vygaTFqs7
tsBitWSmp+Jo7Fc7a5QRX/yL3uyDkXBB7NLPmYitFT5OvcdKg4U0fHigWxhzl8Xs
GMQZrlokbwJ/JxLlB1xYmdotfEYCwMJYc9momYg21FvMPfFu9rRCaG9tZTpWSUZJ
Qm5leGVkaSBPQlMgUHJvamVjdCA8aG9tZTpWSUZJQm5leGVkaUBidWlsZC5vcGVu
c3VzZS5vcmc+iGYEExECACYFAlOMizICGwMFCQhAB4IGCwkIBwMCBBUCCAMEFgID
AQIeAQIXgAAKCRAutNL5lKY5h3y4AJ4qgG9vVq7jPWW+oiFlO+xW9X7YrgCgs/oW
2c0IgUcwyXKNlbSYqGyu0l2IRgQTEQIABgUCT2szsAAKCRA7MBG3a51lI7sdAJ9q
/+6D3FndEZieHpJw/kG1eZLu/ACeKk0hcqg9zrFwj21oBr96kOBXCTs=
=8ciq
-----END PGP PUBLIC KEY BLOCK-----
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE peer (
prefix TEXT PRIMARY KEY NOT NULL,
address TEXT NOT NULL);
CREATE TABLE config (
name TEXT PRIMARY KEY NOT NULL,
value);
COMMIT;
[home_VIFIBnexedi]
name=SlapOS-Node (CentOS_CentOS-6)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_CentOS-6/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_CentOS-6//repodata/repomd.xml.key
enabled=1
[home_VIFIBnexedi]
name=SlapOS-Node (CentOS_7)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_7/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/VIFIBnexedi/CentOS_7//repodata/repomd.xml.key
enabled=1
[home_VIFIBnexedi]
name=SlapOS-Node (Fedora_20)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/VIFIBnexedi/Fedora_20/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/VIFIBnexedi/Fedora_20//repodata/repomd.xml.key
enabled=1
[home_VIFIBnexedi]
name=SlapOS-Node (Fedora_21)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/VIFIBnexedi/Fedora_21/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/VIFIBnexedi/Fedora_21//repodata/repomd.xml.key
enabled=1
---
- name: Install vifib package repository
apt_repository:
repo: "deb http://download.opensuse.org/repositories/home:/VIFIBnexedi/Debian_{{ ansible_distribution_major_version }}.0 ./"
state: present
update_cache: yes
- apt_key:
data: "{{ lookup('file', 'key_1A716324.gpg') }}"
- apt_key:
data: "{{ lookup('file', 'key_2EB4D2F994A63987.gpg') }}"
- name: Purge old re6stnet package
apt: name=re6stnet state=absent purge=yes
- name: Install re6st-node package
apt: name=re6st-node update_cache=yes state=latest
---
- command: mktemp
register: export_csv
- name: Backup re6st certificates
command: cp -r /etc/re6stnet /etc/re6stnet.back creates=/etc/re6stnet.back removes=/etc/re6stnet
- apt: name=sqlite3 state=present update_cache=yes
when: ansible_os_family == "Debian"
- yum: name=sqlite state=present update_cache=yes
when: ansible_os_family == "Centos" or ansible_os_family == "RedHat"
- name: Dump cache
shell: sqlite3 -noheader -csv /var/lib/re6stnet/peers.db "select * from peer;" > {{ export_csv.stdout }} removes=/var/lib/re6stnet/peers.db
- include: debian.yml
when: ansible_os_family == "Debian"
- include: rhel.yml
when: ansible_os_family == "Centos" or ansible_os_family == "RedHat"
- file: path=/var/lib/re6stnet owner=root group=root mode=0755 state=directory
- copy:
src: re6st_db_create.sql
dest: /tmp/
owner: root
group: root
mode: 0644
- name: Create new cache
shell: sqlite3 /var/lib/re6stnet/cache.db < /tmp/re6st_db_create.sql && rm /tmp/re6st_db_create.sql
- name: Fill new cache
command: sqlite3 -noheader -csv /var/lib/re6stnet/cache.db ".import {{ export_csv.stdout }} peer"
- name: Restart re6stnet service
service: name=re6stnet enabled=yes state=restarted
- command: rm {{ export_csv.stdout }}
---
- name: Install vifib package repository
copy:
src: vifib_{{ ansible_distribution|lower }}{{ ansible_distribution_major_version }}.repo
dest: /etc/yum.repos.d/
owner: root
group: root
mode: 0644
- name: Purge old re6stnet package
yum: name=re6stnet state=absent
- name: Install re6st-node package
yum: name=re6st-node update_cache=yes state=latest
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!