Ansible gives you conditionals to use when you want to check if something meets a certain criteria. However conditionals can become annoying if you need many include statements or repeat tasks based on facts. Here’s a way to minimize the need for them in the tasks themselves. Let’s take Apache for example: - name: install apache package: name: httpd state: installed when: ansible_distribution == 'CentOS' - name: install apache package: name: apache2 state: installed when: ansible_distribution == 'Ubuntu' This can become annoying and hard to read when it’s all in one file.
One of Tower’s big selling points is the RESTful API. This allows systems to request certain templates to run against themselves from Tower. I leverage this on workstations with a systemd service and timer. Each workstation waits a predetermined time after boot and then does an API call to Tower. Tower then runs the workstation provision template against the system that requested it. To enable callbacks, just check “Allow Provisioning Callbacks.
- NEWER POSTS
- page 2 of 2