Lets assume:
1.) You have an infrastructure and therefore build your inventory file hosts.ini
like
[controlnode]
ctrl.example.com
[rudder_server]
pol.example.com
[rudder_clients]
wrkst1.example.com
wrkst2.example.com
wrkst3.example.com
2.) You like to organize and group variables in a file group_vars/rudder_clients/policy_server
---
policy_server: pol.example.com
3.) You don't want to do curl {something} | sudo bash -
because of "Is that really a reasonably safe installation method?" - therefore the Bash installation script is already downloaded, reviewed and stored under group_files/rudder_clients/rudder-setup.sh
.
A minimal example playbook could look like
- hosts: rudder_clients
become: true
gather_facts: false
# For convenience and demonstration purpose stored here
# instead of the corresponding group_vars file
vars:
role: 'setup-agent'
version: '7.3'
tasks:
- name: Install Rudder Agent on Workstations
script: rudder-setup.sh {{ role }} {{ version }} {{ policy_server }}
args:
creates: /opt/rudder-setup.sh
executable: /bin/bash
Further Documentation
Please take note that this needs to be adjusted to your needs, it is not considered as a good practice and you may also have a look into
How to proceed further?
Since the above (script)
... will setup Rudder repository on your system and the use the package manager to install rudder ... in latest version ...
you probably want to convert rudder-setup.sh
script parts into an Ansible playbook at all instead of just executing it. For the agent part it looks achievable within a day and to do so, start from line 846
and # Setup rudder agent #
first.
By doing this you will take advantage of all available Ansible capabilities and modules like Conditionals based on ansible_facts
, package_facts
, yum_repository
, yum
, service
, systemctl
etc., and many more. It would end up in something simple like shown in Running node_exporter
with Ansible.
In order to proceed further you might find out during your research that there is already a Rudder Ansible Collection and a role to install rudder_agent
. So you may either use it as it is or adopt from there.