Linux server administration/sar/Installing sysstat using Ansible

From Wikiversity
Jump to navigation Jump to search
#!/usr/bin/env ansible-playbook 

  remote_user: YOUR_REMOTEUSER 
  become: yes
  connection: ssh

    - name: Install and start as service sysstat for Ubuntu 
      - package:
          name: sysstat
          state: present	

      - lineinfile:
          path: /etc/default/sysstat
          state: present
          backrefs: yes
          regexp: '^ENABLED="false"'
          line: 'ENABLED="true"'

      - service:
          name: sysstat
          state: started
          enabled: yes
      when: ansible_distribution == 'Ubuntu'


[edit | edit source]
  1. Modify Ansible playbook to include a parameters for modifying default collection interval and collection options: SADC_OPTIONS="-S XALL" in /etc/sysstat/sysstat (man sadc for more options)
  2. Modify Ansible playbook for RedHat

See also

[edit | edit source]
  1. DevOps/Ansible/Configure user to be able to use sudo with no password