Playbook - Registro de servidores Red Hat no Satellite via Ansible

ChicoFedora
editado November 2019 em Servidores

Depois de pesquisar muito e juntar vários módulos, consegui organizar uma forma de registrar vários servidores no Satellite, através do Ansible, este playbook foi criado neste intuito.
Deixo aqui esse registro afim de ajudar outros usuários que por ventura venham a precisar.

- hosts: all
  gather_facts: no
  tasks:
   - name: Download Katello CA rpm
     get_url:
       url: http://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm
       dest: /tmp/katello-ca-consumer-latest.noarch.rpm
       mode: '0440'

   - name: install Katello CA rpm from a local file
     yum:
       name: /tmp/katello-ca-consumer-latest.noarch.rpm
       state: present

   - name: Register with activationkey
     redhat_subscription:
       state: present
       activationkey: rhel7_base
       org_id: example

   - name: Enable all RHSM repositories
     rhsm_repository:
       name: '*'
       state: enabled

   - name: Install Packages
     yum:
       name: 
         - katello-host-tools 
         - katello-host-tools-tracer 
         - katello-agent
         - insights-client
         - puppet
       state: present

   - name: Start and enabled service Puppet agent
     systemd:
       name: puppet
       state: started
       enabled: true

   - name: Start and enabled service katello agent
     systemd:
       name: goferd
       state: started
       enabled: true

   - name: upgrade all packages
     yum:
       name: '*'
       state: latest

Comentários