Ansible playbook for updating Discourses

Ah sorry yes it’s a private repo. I almost never do that! I must have been embarrassed about the uselessness of that stuff… :rofl:

Here’s that file:

---
- hosts: all
  vars:
    ansible_python_interpreter: auto_silent

  tasks:
  - name: Update server OS (apt update && apt dist-upgrade && apt autoremove && apt autoclean)
    become: yes
    apt:
      update-cache: yes
      upgrade: dist
      autoremove: yes
      autoclean: yes

  # - name: Update Discourse code from GitHub (cd /var/discourse && git pull)
  #   become: yes
  #   git:
  #     repo: 'https://github.com/discourse/discourse_docker.git'
  #     dest: /var/discourse
  #     update: yes
  #     version: master
  #   register: gitcommit

  # - name: Rebuild the Discourse container (cd /var/discourse && ./launcher rebuild app)
  #   become: yes
  #   shell: ./launcher rebuild app
  #   args:
  #     chdir: /var/discourse
  #   when: gitcommit.changed

  # - name: Clean up stopped containers (cd /var/discourse && ./launcher cleanup)
  #   become: yes
  #   shell: echo Y | ./launcher cleanup
  #   args:
  #     chdir: /var/discourse

  # - name: Reboot machine with default Ansible settings
  #   reboot:
  #   become: yes

As you can see it’s almost useless as it is.

If there was any interest in developing some shared scripts for automating updating OS, Discourse, launcher cleanup, and (for bonus points) writing in the Changelog of each Discourse instance, then I’d be up for helping. For just me it’s not quite worth maintaining my own Ansible playbooks.

1 Like