ansible-aix / ansible-power-aix

Developer contributions for Ansible Automation on Power
GNU General Public License v3.0
3 stars 1 forks source link

New bootptab role #74

Open robinvy opened 4 years ago

robinvy commented 4 years ago

Can we modify this configuration file?

dberg1 commented 4 years ago

I could not find any existing bootp module for Ansible.

dberg1 commented 4 years ago

Here is an example showing how to add an entry to /etc/bootptab and how to enable bootp server and restart inetd. The example uses lineinfile, replace and service Ansible core modules.

- hosts: aix
  gather_facts: no

  handlers:
  - name: restart inetd
    service: name=inetd state=restarted
  tasks:
  - name: add booptab entry
    lineinfile:
      path: /etc/bootptab
      regexp: '^myclient:'
      line: 'myclient:bf=/var/lib/tftpboot/core.elf:ip=10.0.0.2:sa=10.0.0.10:ht=ethernet:gw=10.0.0.1:sm=255.0.0.0:'
  - name: enable bootp server
    replace:
      path: /etc/inetd.conf
      regexp: '^#(bootps\s)'
      replace: '\1'
      backup: yes
      owner: root
      group: system
      mode: 0664
    notify: restart inetd
robinvy commented 4 years ago

Please create a role for this kind of activities.