From: Alexandru Avadanii Date: Tue, 21 Mar 2017 18:01:23 +0100 Subject: [PATCH 1/2] Revert "Fix deletion graph (no cobbler mode)" This reverts commit 83ae1d3d617e5043309d72802cd186c22405738a. --- deployment/puppet/fuel/examples/hiera.pp | 1 + deployment/puppet/fuel/examples/provision.pp | 97 +++++++++++----------- deployment/puppet/provision/manifests/dhcpd.pp | 18 ++-- deployment/puppet/provision/manifests/named.pp | 22 ++--- deployment/puppet/provision/manifests/params.pp | 34 ++++---- deployment/puppet/provision/manifests/tftp.pp | 29 ++++--- .../puppet/provision/templates/xinetd.conf.erb | 4 +- graphs/deletion/tasks.yaml | 39 ++++----- graphs/provision/tasks.yaml | 2 +- 9 files changed, 119 insertions(+), 127 deletions(-) diff --git a/deployment/puppet/fuel/examples/hiera.pp b/deployment/puppet/fuel/examples/hiera.pp index 916cd6f..58bae50 100644 --- a/deployment/puppet/fuel/examples/hiera.pp +++ b/deployment/puppet/fuel/examples/hiera.pp @@ -6,6 +6,7 @@ $data = [ 'nodes', 'networks', 'astute', + 'known_hosts', 'provision', 'common', ] diff --git a/deployment/puppet/fuel/examples/provision.pp b/deployment/puppet/fuel/examples/provision.pp index f07f700..9b2aa26 100644 --- a/deployment/puppet/fuel/examples/provision.pp +++ b/deployment/puppet/fuel/examples/provision.pp @@ -2,20 +2,19 @@ notice('MODULAR: provision.pp') Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'} -$fuel_settings = parseyaml($astute_settings_yaml) - -$mco_user = $::fuel_settings['mcollective']['user'] -$mco_pass = $::fuel_settings['mcollective']['password'] -$dns_address = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] -$domain_name = $::fuel_settings['DNS_DOMAIN'] -$dns_search = $::fuel_settings['DNS_SEARCH'] -$forwarders = split($::fuel_settings['DNS_UPSTREAM'], ',') -$start_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_start'] -$end_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_end'] -$network_mask = $::fuel_settings['ADMIN_NETWORK']['netmask'] -$network_address = ipcalc_network_by_address_netmask($start_address, $network_mask) -$dhcp_gateway = $::fuel_settings['ADMIN_NETWORK']['dhcp_gateway'] - +$fuel_settings = parseyaml($astute_settings_yaml) + +$mco_user = $::fuel_settings['mcollective']['user'] +$mco_pass = $::fuel_settings['mcollective']['password'] +$dns_address = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] +$domain_name = $::fuel_settings['DNS_DOMAIN'] +$dns_search = $::fuel_settings['DNS_SEARCH'] +$forwarders = split($::fuel_settings['DNS_UPSTREAM'], ',') +$start_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_start'] +$end_address = $::fuel_settings['ADMIN_NETWORK']['dhcp_pool_end'] +$network_mask = $::fuel_settings['ADMIN_NETWORK']['netmask'] +$network_address = ipcalc_network_by_address_netmask($start_address, $network_mask) +$dhcp_gateway = $::fuel_settings['ADMIN_NETWORK']['dhcp_gateway'] if $dhcp_gateway { $router = $dhcp_gateway } @@ -23,20 +22,22 @@ else { $router = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] } -$next_server = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] -$nailgun_api_url = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}:8000/api" -$ethdevice_timeout = hiera('ethdevice_timeout', '120') -$ddns_key = hiera('ddns_key', 'VyCWe0kutrawqQ2WEFKkAw=') -$ddns_key_algorithm = hiera('ddns_key_algorithm', 'HMAC-MD5') -$ddns_key_name = hiera('ddns_key_name', 'DHCP_UPDATE') -$bootstrap_menu_label = hiera('bootstrap_menu_label', 'bootstrap') +$next_server = $::fuel_settings['ADMIN_NETWORK']['ipaddress'] + +$nailgun_api_url = "http://${::fuel_settings['ADMIN_NETWORK']['ipaddress']}:8000/api" +$ethdevice_timeout = hiera('ethdevice_timeout', '120') + +$ddns_key = hiera('ddns_key', 'VyCWe0kutrawqQ2WEFKkAw=') +$ddns_key_algorithm = hiera('ddns_key_algorithm', 'HMAC-MD5') +$ddns_key_name = hiera('ddns_key_name', 'DHCP_UPDATE') + +$bootstrap_menu_label = hiera('bootstrap_menu_label', 'bootstrap') $bootstrap_kernel_path = hiera('bootstrap_kernel_path', '/images/vmlinuz') $bootstrap_initrd_path = hiera('bootstrap_initrd_path', '/images/initrd.img') -$bootstrap_settings = pick($::fuel_settings['BOOTSTRAP'], {}) -$bootstrap_path = pick($bootstrap_settings['path'], '/var/www/nailgun/bootstraps/active_bootstrap') -$metadata_yaml = file("${bootstrap_path}/metadata.yaml", '/dev/null') - +$bootstrap_settings = pick($::fuel_settings['BOOTSTRAP'], {}) +$bootstrap_path = pick($bootstrap_settings['path'], '/var/www/nailgun/bootstraps/active_bootstrap') +$metadata_yaml = file("${bootstrap_path}/metadata.yaml", '/dev/null') if empty($metadata_yaml) { $bootstrap_meta = {} } else { @@ -50,44 +51,44 @@ $known_hosts = get_merged_network_metadata_from_yamls() $chain32_files = tftp_files("/var/lib/tftpboot/pxelinux.cfg", $known_hosts) class { "::provision::dhcpd" : - network_address => ipcalc_network_by_address_netmask($start_address, $network_mask), - network_mask => $network_mask, - broadcast_address => $broadcast_address, - start_address => $start_address, - end_address => $end_address, - router => $router, - next_server => $next_server, - dns_address => $dns_address, - domain_name => $domain_name, - ddns_key => $ddns_key, + network_address => ipcalc_network_by_address_netmask($start_address, $network_mask), + network_mask => $network_mask, + broadcast_address => $broadcast_address, + start_address => $start_address, + end_address => $end_address, + router => $router, + next_server => $next_server, + dns_address => $dns_address, + domain_name => $domain_name, + ddns_key => $ddns_key, ddns_key_algorithm => $ddns_key_algorithm, - ddns_key_name => $ddns_key_name, - known_hosts => $known_hosts, + ddns_key_name => $ddns_key_name, + known_hosts => $known_hosts, } class { "::provision::tftp" : - bootstrap_menu_label => $bootstrap_menu_label, - bootstrap_kernel_path => $bootstrap_kernel_path, - bootstrap_initrd_path => $bootstrap_initrd_path, + bootstrap_menu_label => $bootstrap_menu_label, + bootstrap_kernel_path => $bootstrap_kernel_path, + bootstrap_initrd_path => $bootstrap_initrd_path, bootstrap_kernel_params => $bootstrap_kernel_params, - chain32_files => $chain32_files, + chain32_files => $chain32_files, } -> -file { "/var/lib/tftpboot/${bootstrap_kernel_path}" : +file { "/var/lib/tftpboot${bootstrap_kernel_path}" : source => "${bootstrap_path}/vmlinuz", } -> -file { "/var/lib/tftpboot/${bootstrap_initrd_path}" : +file { "/var/lib/tftpboot${bootstrap_initrd_path}" : source => "${bootstrap_path}/initrd.img" } class { "::provision::named" : - domain_name => $domain_name, - dns_address => $dns_address, - forwarders => $forwarders, - ddns_key => $ddns_key, + domain_name => $domain_name, + dns_address => $dns_address, + forwarders => $forwarders, + ddns_key => $ddns_key, ddns_key_algorithm => $ddns_key_algorithm, - ddns_key_name => $ddns_key_name, + ddns_key_name => $ddns_key_name, } -> file { '/etc/resolv.conf': diff --git a/deployment/puppet/provision/manifests/dhcpd.pp b/deployment/puppet/provision/manifests/dhcpd.pp index f0e970a..6837532 100644 --- a/deployment/puppet/provision/manifests/dhcpd.pp +++ b/deployment/puppet/provision/manifests/dhcpd.pp @@ -14,10 +14,9 @@ class provision::dhcpd ( $known_hosts = [], ) inherits provision::params { - $package_name = $::provision::params::dhcpd_package - $service_name = $::provision::params::dhcpd_service - - package { $package_name : } + package { "dhcpd" : + name => $::provision::params::dhcpd_package, + } file { $::provision::params::dhcpd_conf : ensure => present, @@ -25,8 +24,8 @@ class provision::dhcpd ( owner => 'dhcpd', group => 'dhcpd', mode => '0640', - require => Package[$package_name], - notify => Service[$service_name], + require => Package["dhcpd"], + notify => Service["dhcpd"], } file { $::provision::params::dhcpd_conf_d : @@ -34,7 +33,7 @@ class provision::dhcpd ( owner => 'root', group => 'root', mode => '0755', - require => Package[$package_name], + require => Package["dhcpd"], } # It is just a file that could be modified by other modules @@ -43,12 +42,13 @@ class provision::dhcpd ( require => File[$::provision::params::dhcpd_conf_d], } - service { $service_name : + service { "dhcpd" : + name => $::provision::params::dhcpd_service, ensure => running, enable => true, hasrestart => false, hasstatus => false, - require => Package[$package_name], + require => Package["dhcpd"], } } diff --git a/deployment/puppet/provision/manifests/named.pp b/deployment/puppet/provision/manifests/named.pp index 6609fee..ee940c9 100644 --- a/deployment/puppet/provision/manifests/named.pp +++ b/deployment/puppet/provision/manifests/named.pp @@ -7,17 +7,16 @@ class provision::named ( $ddns_key_name = $::provision::params::ddns_key_name, ) inherits provision::params { - $package_name = $::provision::params::named_package - $service_name = $::provision::params::named_service - - package { $package_name : } + package { "named" : + name => $::provision::params::named_package, + } file { "/var/named" : ensure => directory, owner => 'named', group => 'named', mode => '0750', - require => Package[$package_name], + require => Package["named"], } file { $::provision::params::named_conf : @@ -26,8 +25,8 @@ class provision::named ( owner => 'named', group => 'named', mode => '0640', - require => Package[$package_name], - notify => Service[$service_name], + require => Package["named"], + notify => Service["named"], } file { "/var/named/${domain_name}" : @@ -36,16 +35,17 @@ class provision::named ( owner => 'named', group => 'named', mode => '0644', - require => Package[$package_name], - notify => Service[$service_name], + require => Package["named"], + notify => Service["named"], } - service { $service_name : + service { "named" : + name => $::provision::params::named_service, ensure => running, enable => true, hasrestart => false, hasstatus => false, - require => Package[$package_name], + require => Package["named"], } } diff --git a/deployment/puppet/provision/manifests/params.pp b/deployment/puppet/provision/manifests/params.pp index 1508edd..2bcae12 100644 --- a/deployment/puppet/provision/manifests/params.pp +++ b/deployment/puppet/provision/manifests/params.pp @@ -14,23 +14,23 @@ class provision::params { fail("Unsupported osfamily ${::osfamily}") } } - $network_address = "10.20.0.0" - $network_mask = "255.255.255.0" - $broadcast_address = "10.20.0.255" - $start_address = "10.20.0.3" - $end_address = "10.20.0.254" - $router = "10.20.0.1" - $next_server = "10.20.0.2" - $dns_address = "10.20.0.2" - $forwarders = ["8.8.8.8", "8.8.4.4"] - $domain_name = "domain.tld" - $ddns_key = "VyCWe0kutrawqQ2WEFKkAw==" - $ddns_key_algorithm = "HMAC-MD5" - $ddns_key_name = "DHCP_UPDATE" - $bootstrap_kernel_path = "/images/ubuntu_bootstrap/vmlinuz" - $bootstrap_initrd_path = "/images/ubuntu_bootstrap/initrd.img" + $network_address = "10.20.0.0" + $network_mask = "255.255.255.0" + $broadcast_address = "10.20.0.255" + $start_address = "10.20.0.3" + $end_address = "10.20.0.254" + $router = "10.20.0.1" + $next_server = "10.20.0.2" + $dns_address = "10.20.0.2" + $forwarders = ["8.8.8.8", "8.8.4.4"] + $domain_name = "domain.tld" + $ddns_key = "VyCWe0kutrawqQ2WEFKkAw==" + $ddns_key_algorithm = "HMAC-MD5" + $ddns_key_name = "DHCP_UPDATE" + + $bootstrap_kernel_path = "/images/ubuntu_bootstrap/vmlinuz" + $bootstrap_initrd_path = "/images/ubuntu_bootstrap/initrd.img" $bootstrap_kernel_params = "ksdevice=bootif lang= console=ttyS0,9600 console=tty0 toram locale=en_US text boot=live biosdevname=0 components ip=frommedia ethdevice-timeout=120 net.ifnames=1 panic=60" - $bootstrap_menu_label = "ubuntu_bootstrap" - $tftp_root = "/var/lib/tftpboot" + $bootstrap_menu_label = "ubuntu_bootstrap" } diff --git a/deployment/puppet/provision/manifests/tftp.pp b/deployment/puppet/provision/manifests/tftp.pp index 39c7633..f05bd16 100644 --- a/deployment/puppet/provision/manifests/tftp.pp +++ b/deployment/puppet/provision/manifests/tftp.pp @@ -1,10 +1,9 @@ class provision::tftp ( $bootstrap_kernel_params = $::provision::params::bootstrap_kernel_params, - $bootstrap_kernel_path = $::provision::params::bootstrap_kernel_path, - $bootstrap_initrd_path = $::provision::params::bootstrap_initrd_path, - $bootstrap_menu_label = $::provision::params::bootstrap_menu_label, - $tftp_root = $::provision::params::tftp_root, - $chain32_files = [], + $bootstrap_kernel_path = $::provision::params::bootstrap_kernel_path, + $bootstrap_initrd_path = $::provision::params::bootstrap_initrd_path, + $bootstrap_menu_label = $::provision::params::bootstrap_menu_label, + $chain32_files = [], ) inherits provision::params { Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'} @@ -46,7 +45,7 @@ class provision::tftp ( ensure_packages($tftp_packages) - file { ["${tftp_root}/images", "${tftp_root}/pxelinux.cfg"] : + file { ["/var/lib/tftpboot/images", "/var/lib/tftpboot/pxelinux.cfg"] : ensure => directory, owner => 'root', group => 'root', @@ -54,35 +53,35 @@ class provision::tftp ( require => Package[$tftp_packages], } - file { "${tftp_root}/pxelinux.cfg/default" : + file { "/var/lib/tftpboot/pxelinux.cfg/default" : ensure => present, content => template("provision/tftp.default.erb"), owner => 'root', group => 'root', mode => '0644', - require => File["${tftp_root}/pxelinux.cfg"], + require => File["/var/lib/tftpboot/pxelinux.cfg"], } - file { "${tftp_root}/chain.c32": + file { '/var/lib/tftpboot/chain.c32': source => '/usr/share/syslinux/chain.c32', require => Package[$tftp_packages], } - file { "${tftp_root}/pxelinux.0": + file { '/var/lib/tftpboot/pxelinux.0': source => '/usr/share/syslinux/pxelinux.0', require => Package[$tftp_packages], } - file { "${tftp_root}/menu.c32": + file { '/var/lib/tftpboot/menu.c32': source => '/usr/share/syslinux/menu.c32', require => Package[$tftp_packages], } # TODO Create custom type that will remove all 01-* files that # are not in the $chain32_files list - exec { "remove ${tftp_root}/pxelinux.cfg/01-* files" : - command => "find ${tftp_root}/pxelinux.cfg -type f -name '01-*' -delete", - require => File["${tftp_root}/pxelinux.cfg"], + exec { 'remove /var/lib/tftpboot/pxelinux.cfg/01-* files' : + command => "find /var/lib/tftpboot/pxelinux.cfg -type f -name '01-*' -delete", + require => File["/var/lib/tftpboot/pxelinux.cfg"], } -> file { $chain32_files : @@ -91,6 +90,6 @@ class provision::tftp ( owner => 'root', group => 'root', mode => '0644', - require => File["${tftp_root}/pxelinux.cfg"], + require => File["/var/lib/tftpboot/pxelinux.cfg"], } } diff --git a/deployment/puppet/provision/templates/xinetd.conf.erb b/deployment/puppet/provision/templates/xinetd.conf.erb index 1ff50ba..0a90f33 100644 --- a/deployment/puppet/provision/templates/xinetd.conf.erb +++ b/deployment/puppet/provision/templates/xinetd.conf.erb @@ -1,10 +1,10 @@ defaults { - log_type = SYSLOG daemon info + log_type = SYSLOG daemon info log_on_failure = HOST log_on_success = PID HOST DURATION EXIT - cps = 50 10 + cps = 50 10 instances = 50 per_source = 10 diff --git a/graphs/deletion/tasks.yaml b/graphs/deletion/tasks.yaml index 2fd0188..a2c678c 100644 --- a/graphs/deletion/tasks.yaml +++ b/graphs/deletion/tasks.yaml @@ -7,44 +7,35 @@ type: stage requires: [deletion_start] -- id: upload_provision_info_master - type: upload_file +- id: cobbler_enable_netboot + type: master_shell version: 2.1.0 - role: ['master'] + role: ['/.*/'] requires: [deletion_start] - required_for: [reconfigure_dhcpd] + required_for: [move_to_bootstrap] parameters: - path: /var/lib/fuel/configs/{CLUSTER_ID}/provision.yaml + cmd: + yaql_exp: 'concat("sh /etc/puppet/modules/osnailyfacter/modular/provision/netboot enable ", $.provision.name)' timeout: 180 - data: - #TODO: Replace dict($.items) to $ when LP1666913 is fixed - yaql_exp: "($.provision.set('packages', $.provision.packages) + $.repo_setup + dict('output' => '/var/www/nailgun/targetimages') + dict($.items())).toYaml()" -- id: reconfigure_dhcpd - type: puppet - version: 2.1.0 - role: ['master'] - requires: [upload_provision_info_master] - required_for: [node_reboot] - parameters: - puppet_manifest: /etc/puppet/modules/fuel/examples/provision.pp - puppet_modules: /etc/puppet/modules - timeout: 3600 - -- id: node_reboot - type: reboot +- id: move_to_bootstrap + type: move_to_bootstrap version: 2.1.0 role: ['/.*/'] - requires: [reconfigure_dhcpd] + requires: [cobbler_enable_netboot] required_for: [node_erase] parameters: - timeout: 300 + slave_name: + yaql_exp: '$.provision.name' + provisioning_info: + yaql_exp: '$.provision' + timeout: 180 - id: node_erase type: erase_node version: 2.1.0 role: ['/.*/'] - requires: [node_reboot] + requires: [move_to_bootstrap] required_for: [deletion_end] parameters: timeout: 180 diff --git a/graphs/provision/tasks.yaml b/graphs/provision/tasks.yaml index 1494176..3a21c87 100644 --- a/graphs/provision/tasks.yaml +++ b/graphs/provision/tasks.yaml @@ -85,7 +85,7 @@ type: reboot version: 2.1.0 role: ['/.*/'] - requires: [system_provision] + requires: [cobbler_disable_netboot] required_for: [set_status_provisioned] parameters: timeout: 900