Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

mantl dnsmasq

TanyaCouture edited this page Feb 25, 2016 · 1 revision
  • dnsmasq: mantl-dnsmasq: already merged asteris-lc/mantl-packaging/mantl/mantl-dns

    • Dependencies
      • dnsmasq
      • bind-utils
      • NetworkManager
      • distributive.yml
    /files/distributive-dnsmasq-check.json
    
    /handlers/main.yml
      - run 2 commands on nodes
      - sudo systemctl restart NetworkManager
      - sudo systemctl restart dnsmasq
      packaging solutions:
        ansible all -i plugins/inventory/terraform.py -a "sudo systemctl restart NetworkManager"
        ansible all -i plugins/inventory/terraform.py -a "sudo systemctl restart dnsmasq"
    
    /tasks/distributive.yml
      - create directory (and subdirectories)at destination /etc/consul when consul_dc_group is defined
      - chmod 0700
      - tags are consul, distributive, dnsmasq
      packaging solutions:
        // export consul_dc_group variable?
        #!/bin/bash
        echo ${consul_dc_group:? "consul_dc_group is not defined"}
        sudo mkdir /etc/consul/
        sudo chmod 0700 /etc/consul
    
      line 16
      - sudo
      - create a symlink to distributive dnsmasq checklist from
        /usr/share/distributive/dnsmasq.json to /etc/distributive.d/dnsmasq.json
      - tags are consul, distributive, dnsmasq
      packaging solutions:
        ln -s /etc/distributive.d/dnsmasq.json /usr/share/distributive/dnsmasq.json
    
      line 27
      // register distributive tests with consul
      - sudo
      - copy distributive-dnsmasq-check.json to /etc/consul/ when consul_dc_group is defined
      - reload consul
      - tags are consul, distributive, dnsmasq
      packaging solutions:
        // export consul_dc_group variable?
        #!/bin/bash
        echo ${consul_dc_group:? "consul_dc_group is not defined"}
        cp distributive-dnsmasq-check.json /etc/consul/ (check which directory the json file is in)  
    
    /tasks/main.yml
      - sudo yum install latest versions of packages dnsmasq, bind-utils, NetworkManager
      - tags are dnsmasq and bootstrap
      packaging solutions:
          sudo yum -y install dnsmasq bind-utils NetworkManager
    
      line 15
      //collect nameservers
      - run shell command on node:  "sudo cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2"
      - the output of the above command should be set to variable "nameservers_output"
      - tag is dnsmasq
      packaging solutions:
         ansible all -i plugins/inventory/terraform.py -a "nameservers_output = $(sudo cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2)"
    
      line 22
      - run shell command on node: "cat /etc/resolv.conf | grep -i '^search' | cut -d ' ' -f2- | tr ' ' '\n'"
      - store output in variable "dns_search_list_output"
      - tag is dnsmasq
      packaging solutions:
           ansible all -i plugins/inventory/terraform.py -a "dns_search_list_output = $(sudo cat /etc/resolv.conf | grep -i '^search' | cut -d ' ' -f2- | tr ' ' '\n')"
    
      line 29
      // set nameservers
      // establish key-value pairs
        - nameservers:  "{{ nameservers_output.stdout_lines }}"
      // tag dnsmasq  
      packaging solutions: call a python script keyvalue.py(set permissions first). Give the function argument nameservers_output (can you pass arguments to scripts?)
        // iterate through nameservers_output
        // set key-value pairs(nameservers: nameservers_output.stdout_lines)
    
      line 35
      // set dns search list(key-value pair)
        - domain_search_list: "{{ dns_search_list_output.stdout_lines }}"
      // tag is dnsmasq
      packaging solutions: call keyvalue.py
    
      line 41
      // ensure dnsmasq.d directory exists
        - sudo create directory and subdirectories(if they are there): /etc/NetworkManager/dnsmasq.d
      // tag is dnsmasq
      packaging solutions:
        sudo mkdir /etc/NetworkManager/dnsmasq.d
    
      line 49
      // configure dnsmasq for consul
        // when consul_dc_group is defined
            // sudo
            // copy 10-consul to /etc/dnsmasq.d/10-consul
            // chmod 0755
            // restart dnsmasq
        // tag is dnsmasq
        packaging solutions:
           sudo cp 10-consul /etc/dnsmasq.d
           sudo chmod 0755 /etc/dnsmasq.d/10-consul
           sudo systemctl restart dnsmasq
    
      line 61
      // configure dnsmasq for Kubernetes
        // when cluster_name is defined
          // sudo
          // copy 20-kubernetes to /etc/dnsmasq.d/20-kubernetes
          // chmod 0755
          // restart dnsmasq
        // tag is dnsmasq
        packaging solutions:
          sudo cp 20-kubernetes /etc/dnsmasq.d/20-kubernetes
          sudo chmod 0755
          sudo systemctl restart dnsmasq
    
      line 73
      // sudo
      // start dnsmasq on boot if necessary
      // dnsmasq is tag
    
      line 82
      // configure networkmanager for dnsmasq
      // sudo
      // In the file: /etc/NetworkManager/NetworkManager.conf
      // Insert "dns=none" after the reg expression: "^\\[main\\]$"
      // restart networkmanager
      // tag is dnsmasq
      packaging solutions:
    
    
      line 93
      // List network-scripts which need fixup
      // sudo
      // run shell command "find /etc/sysconfig/network-scripts -name 'ifcfg-*'"
      .*// set the above output to variable "list_of_network_scripts"
      packaging solutions:
          // combine line 93 and 98 by doing find and executing a sed statement(Is the variable list_of_network_scripts needed anywhere else?)
          sudo find /etc/sysconfig/network-scripts -name 'ifcfg-*' -exec sed -i '' 's/^PEERDNS=.*/PEERDNS=no/' \{\} \;
            //   errors  sed: can't read s/^PEERDNS=.*/PEERDNS=no/: No such file or directory
                sed: can't read s/^PEERDNS=.*/PEERDNS=no/: No such file or directory
    
    
      line 98
      // fixing PEERDNS in network-scripts
      // loop: for each in the list_of_network_scripts; do ...the following using ${x} ... ; done
          // sudo
          // modify file: "{{ item }}"
          // look for regular expression ^PEERDNS=.*'
         .*// replace regular expression with "PEERDNS=no"
      // restart networkmanager
      // tag is dnsmasq
      packaging solutions:
        //combined with line 93
    
    
      line 110
      // sudo
      // copy resolv.conf.j2 (format will have to be changed) to /etc/resolv.conf
      // chmod 0644
      // tag is dnsmasq
    
      - meta: flush_handlers
        // dependency of flush_handlers contained in role file meta
    
      - run play distributive.yml(run this subset rather than all of main.yml)
    

    10-consul 20-kubernetes 90-base resolv.conf.j2(needs new format)

Clone this wiki locally