content:en_us:cg_ansible-playbooks

Ansible Playbooks

ClearGLASS allows you to run Ansible playbooks on both newly created systems (after they are deployed) or on existing servers it has ssh access. There are three ways Ansible playbooks can be added in ClearGLASS: inline, via github , or via URL.

Creating playbooks

  • Inline editor
  • Github repository
  • Importing through Url

Running playbooks

  • Running a playbook on a new system
  • Running a playbook on anxisting systems

Inline editor

The simplest way, handy when we only have a few playbooks to add. In the Scripts section, select Ansible Playbook as the type, Inline as Source and paste your playbook (making sure that indentation is preserved while pasting). Press Add to save the playbook.

[image]

Github repository

To use a github repository as the source of our Ansible scripts, we need to specify the github repo (eg https://github.com/mistio/ansible-examples), and an entry point (which playbook to run, e.g. update.yml).

If the repository is private, we'll have to give access to user https://github.com/mistio-bot so it can clone it.

If you don't specify an entrypoint , it will use main. yml as the default.

[image]

Importing through URL

Alternatively, we can specify a URL which is either an Ansible playbook, or a zip/tar file. If the URL is a zip/tar file, we will need to set the entrypoint (the path of the playbook) (eg ansible/books/update.yml)

If we specify a single Ansible playbook via URL, it has to result to the playbook in text . For example

https://gist.githubusercontent.com/mgogoulos/9cd9645d9f675b253c08/raw/ddc825280090575811efa607b98a79cda42bd9a4/ubuntu-ansible-essential

[image]

Running playbooks

Now that we have added our playbooks, it is time to see how we can run them. We can do that on a newly created system, or on existing systems that ClearGLASS already has ssh access.

Running a playbook on a new system

While we are creating a new machine through the Create Machine wizard, on the Script section, we can select Advanced and select our Ansible playbook. Once the server is deployed, it will run the playbook.

[image]

Running a playbook on an existing system

We can also run our Ansible playbooks on existing servers. Enter the scripts section, select the script, and select Run script. Then, select the machine from the list and click on Run. The playbook will be run on that machine. The list shows only the machines that ClearGLASS can connect to via SSH.

content/en_us/cg_ansible-playbooks.txt · Last modified: 2018/03/14 13:42 by cjones