imfreedom/teamcity-ansible

Parents 0c0d496f38ff
Children f387ee6922ae
Add update and curl roles to update all packages and install curl as well as install libnice on openbsd
--- a/agent.yml Mon Dec 28 22:38:01 2020 -0600
+++ b/agent.yml Mon Dec 28 22:38:43 2020 -0600
@@ -1,8 +1,10 @@
---
- hosts: convey
roles:
+ - role: update
- role: cron-apt
- role: qemu-user-static
+ - role: curl
- role: docker
- role: convey
convey_version: 0.13.1
@@ -15,6 +17,7 @@
teamcity_server: https://ci.imfreedom.org/
- hosts: simple
roles:
+ - role: update
- role: cron-apt
- role: mercurial
- role: git
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/curl/tasks/darwin.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,6 @@
+- name: install dependencies
+ homebrew:
+ name: curl
+ state: present
+ become: no
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/curl/tasks/debian.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,7 @@
+---
+- name: install
+ apt:
+ name:
+ - curl
+ state: present
+ force_apt_get: true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/curl/tasks/freebsd.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,4 @@
+- name: install dependencies
+ pkgng:
+ name: curl
+ state: present
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/curl/tasks/main.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,10 @@
+---
+- include_tasks: darwin.yml
+ when: ansible_system == "Darwin"
+- include_tasks: debian.yml
+ when: ansible_facts['os_family'] == "Debian"
+- include_tasks: freebsd.yml
+ when: ansible_system == "FreeBSD"
+- include_tasks: openbsd.yml
+ when: ansible_system == "OpenBSD"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/curl/tasks/openbsd.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,4 @@
+- name: install dependencies
+ openbsd_pkg:
+ name: curl
+ state: present
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/pidgin3-dependencies/tasks/openbsd-libnice.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,20 @@
+- name: "set libnice version"
+ set_fact:
+ libnice_version: "0.1.18"
+- name: "install gtar"
+ openbsd_pkg:
+ name: "gtar--"
+ state: "present"
+- name: "download libnice"
+ unarchive:
+ src: "https://libnice.freedesktop.org/releases/libnice-{{ libnice_version }}.tar.gz"
+ dest: "/usr/src/"
+ remote_src: "yes"
+- name: "build and install libnice"
+ shell: |
+ meson build
+ ninja -C build install
+ ldconfig /usr/local/lib/
+ args:
+ chdir: "/usr/src/libnice-{{ libnice_version }}"
+
--- a/roles/pidgin3-dependencies/tasks/openbsd.yml Mon Dec 28 22:38:01 2020 -0600
+++ b/roles/pidgin3-dependencies/tasks/openbsd.yml Mon Dec 28 22:38:43 2020 -0600
@@ -1,4 +1,4 @@
-- name: install dependencies
+- name: Install OpenBSD dependencies
openbsd_pkg:
name:
- cmark
@@ -20,3 +20,6 @@
- python-3.7.9p0
- vala
state: present
+- name: "install libnice"
+ include_tasks: "openbsd-libnice.yml"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/defaults/main.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,1 @@
+update: true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/tasks/darwin.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,12 @@
+---
+- name: update homebrew
+ shell: /usr/local/bin/brew update
+ tags:
+ - update
+ become: no
+- name: update packages
+ shell: /usr/local/bin/brew upgrade
+ tags:
+ - update
+ become: no
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/tasks/debian.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,17 @@
+---
+- name: update packages
+ apt:
+ upgrade: dist
+ autoremove: yes
+ update_cache: yes
+ force_apt_get: yes
+ when: update|bool
+ tags:
+ - update
+ register: reboot_required
+ changed_when: "'linux-image-' in reboot_required.stdout"
+- name: reboot
+ reboot:
+ reboot_timeout: 120
+ when: reboot_required|bool
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/tasks/freebsd.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,20 @@
+# most of this is borrowed from
+# https://github.com/fxlv/ansible/blob/master/tasks/freebsd-update.yml
+---
+- name: fetch updates
+ shell: freebsd-update fetch
+ register: result_update
+ changed_when: "'No updates needed' not in result_update.stdout"
+ when: ansible_architecture != 'arm64'
+- name: install updates
+ shell: freebsd-update install
+ when: result_update.changed
+ register: result_update_install
+- name: reboot to updated system
+ reboot:
+ when: result_update_install.changed
+- name: update packages
+ shell: pkg update -f
+- name: upgrade packages
+ shell: pkg upgrade -y
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/tasks/main.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,21 @@
+---
+- name: enable package updates
+ set_fact:
+ update: yes
+ when: not update|bool
+ tags:
+ - never
+ - update
+
+- name: Include MacOS tasks
+ include_tasks: darwin.yml
+ when: update|bool and ansible_system == "Darwin"
+- name: Include Debian tasks
+ include_tasks: debian.yml
+ when: update|bool and ansible_facts['os_family'] == "Debian"
+- name: Include FreeBSD tasks
+ include_tasks: freebsd.yml
+ when: update|bool and ansible_system == "FreeBSD"
+- name: Include OpenBSD tasks
+ include_tasks: openbsd.yml
+ when: update|bool and ansible_system == "OpenBSD"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/roles/update/tasks/openbsd.yml Mon Dec 28 22:38:43 2020 -0600
@@ -0,0 +1,7 @@
+# most of this is borrowed from
+# https://github.com/fxlv/ansible/blob/master/tasks/freebsd-update.yml
+---
+- name: update packages
+ openbsd_pkg:
+ name: '*'
+ state: latest