network_manager.yml 713 B

123456789101112131415161718192021222324252627282930
  1. ---
  2. - import_playbook: ../../init/evaluate_groups.yml
  3. - name: Install and configure NetworkManager
  4. hosts: oo_all_hosts
  5. become: yes
  6. tasks:
  7. - name: install NetworkManager
  8. package:
  9. name: 'NetworkManager'
  10. state: present
  11. register: result
  12. until: result | success
  13. - name: configure NetworkManager
  14. lineinfile:
  15. dest: "/etc/sysconfig/network-scripts/ifcfg-{{ ansible_default_ipv4['interface'] }}"
  16. regexp: '^{{ item }}='
  17. line: '{{ item }}=yes'
  18. state: present
  19. create: yes
  20. with_items:
  21. - 'USE_PEERDNS'
  22. - 'NM_CONTROLLED'
  23. - name: enable and start NetworkManager
  24. service:
  25. name: 'NetworkManager'
  26. state: started
  27. enabled: yes