Role - tripleo-hieradata¶
Role Documentation¶
Welcome to the “tripleo_hieradata” role documentation.
Role Defaults¶
This section highlights all of the defaults and variables set within the “tripleo_hieradata” role.
# `hieradata_content` can be formatted for all hosts or for specific hosts
# containing potentially different values.
#
# Host specific example:
#
# controller1:
# extraconfig:
# foo: bar
# foo2: bar2
# other_hierafile:
# foo: bar3
# controller2:
# extraconfig:
# foo: bar2
# foo2: bar3
# other_hierafile:
# foo: bar
#
#
# Global format example:
#
# extraconfig:
# foo: bar
# foo2: bar2
# other_hierafile:
# foo: bar3
#
hieradata_template: ''
hieradata_files: []
# jinja2 escape trick for simple {{ and }} strings:
hieradata_variable_start_string: "{{ '{{' }}"
hieradata_variable_end_string: "{{ '}}' }}"
hieradata_per_host: false
hieradata_templates_list:
- bootstrap_node
- all_nodes
- vip_data
# define a local address. If the ipv6 is found to be enable on the
# loopback device the local address will be set to "localhost" otherwise
# the local address will be defined as "127.0.0.1".
hieradata_localhost_address: "{{ ('ipv6' in (ansible_lo | default({}))) | ternary('localhost',\
\ '127.0.0.1') }}"
# file included in hieradata hierarchy for ansible to pass data to puppet
hieradata_ansible_file: /etc/puppet/hieradata/ansible_managed.json
Molecule Scenarios¶
Molecule is being used to test the “tripleo_hieradata” role. The following section highlights the drivers in service and provides an example playbook showing how the role is leveraged.
- Driver: podman
- Driver: podman
- Driver: podman
Scenario: ansible_hieradata¶
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
vars:
all_nodes_extra_map_data: {}
cloud_domain: localdomain
cloud_names:
cloud_name_ctlplane: standalone.ctlplane.localdomain
container_cli: podman
control_virtual_ip: 192.168.24.1
ctlplane_ip: 192.168.24.2
ctlplane_subnet_cidr: 24
deploy_artifact_urls: ''
deploy_identifier: '1564455089'
deploy_steps_max: 6
enable_internal_tls: false
enabled_networks: []
enabled_services:
- keystone_admin_api
- keystone_public_api
- ca_certs
- ceph_client
- ceph_mds
- ceph_mgr
- ceph_mon
- ceph_rgw
- ceph_osd
- certmonger_user
- clustercheck
- container_image_prepare
- logrotate_crond
- docker
- docker_registry
- glance_api
- haproxy
- iscsid
- kernel
- keystone
- manila_api
- manila_backend_cephfs
- manila_scheduler
- manila_share
- memcached
- mysql
- mysql_client
- neutron_api
- neutron_plugin_ml2_ovn
- nova_api
- nova_compute
- nova_conductor
- nova_libvirt
- nova_metadata
- nova_migration_target
- nova_scheduler
- nova_vnc_proxy
- ovn_controller
- ovn_dbs
- ovn_metadata
- openstack_clients
- oslo_messaging_notify
- oslo_messaging_rpc
- pacemaker
- placement
- podman
- snmp
- sshd
- chrony
- timezone
- logrotate_tmpwatch
- tripleo_firewall
- tripleo_packages
- tuned
extraconfig:
foo: bar1
foo2: bar2
hosts_entry: "\n192.168.24.1 standalone.localdomain standalone\n192.168.24.1\
\ standalone.ctlplane.localdomain standalone.ctlplane\n"
net_vip_map:
ctlplane: 192.168.24.1
ctlplane_subnet: 192.168.24.1/24
ctlplane_uri: 192.168.24.1
redis: 192.168.24.1
ovn_dbs: 192.168.24.1
network_virtual_ips:
ctlplane:
index: 1
ip_address: 192.168.24.1
network_cidrs:
External_cidr: 192.168.24.2/24
networks:
nova_additional_cell: false
ping_test_ips:
Standalone: 192.168.24.1
primary_role_name: Standalone
role_networks:
- Internal
service_configs:
foo: bar3
service_names:
- ca_certs
- ceph_client
- ceph_mds
- ceph_mgr
- ceph_mon
- ceph_rgw
- ceph_osd
- certmonger_user
- clustercheck
- container_image_prepare
- logrotate_crond
- docker
- docker_registry
- glance_api
- haproxy
- iscsid
- kernel
- keystone
- manila_api
- manila_backend_cephfs
- manila_scheduler
- manila_share
- memcached
- mysql
- mysql_client
- neutron_api
- neutron_plugin_ml2_ovn
- nova_api
- nova_compute
- nova_conductor
- nova_libvirt
- nova_metadata
- nova_migration_target
- nova_scheduler
- nova_vnc_proxy
- ovn_controller
- ovn_dbs
- ovn_metadata
- openstack_clients
- oslo_messaging_notify
- oslo_messaging_rpc
- pacemaker
- placement
- podman
- snmp
- sshd
- chrony
- timezone
- logrotate_tmpwatch
- tripleo_firewall
- tripleo_packages
- tuned
service_net_map:
aodh_api_network: ctlplane
apache_network: ctlplane
barbican_api_network: ctlplane
bindnetwork: ctlplane
ceph_cluster_network: ctlplane
ceph_grafana_network: ctlplane
ceph_mon_network: ctlplane
ceph_rgw_network: ctlplane
cinder_api_network: ctlplane
cinder_iscsi_network: ctlplane
designate_api_network: ctlplane
docker_registry_network: ctlplane
ec2_api_metadata_network: ctlplane
ec2_api_network: ctlplane
etcd_network: ctlplane
ganesha_network: ctlplane
glance_api_network: ctlplane
gnocchi_api_network: ctlplane
haproxy_network: ctlplane
heat_api_cfn_network: ctlplane
heat_api_cloudwatch_network: ctlplane
heat_api_network: ctlplane
horizon_network: ctlplane
ironic_api_network: ctlplane
ironic_inspector_network: ctlplane
ironic_network: ctlplane
keystone_admin_api_network: ctlplane
keystone_public_api_network: ctlplane
manila_api_network: ctlplane
memcached_network: ctlplane
metrics_qdr_network: ctlplane
mistral_api_network: ctlplane
mongodb_network: ctlplane
mysql_network: ctlplane
neutron_api_network: ctlplane
neutron_tenant_network: ctlplane
nova_api_network: ctlplane
nova_libvirt_network: ctlplane
nova_metadata_network: ctlplane
nova_vnc_proxy_network: ctlplane
novajoin_network: ctlplane
octavia_api_network: ctlplane
openshift_infra_network: ctlplane
openshift_master_network: ctlplane
oslo_messaging_notify_network: ctlplane
oslo_messaging_rpc_network: ctlplane
ovn_dbs_network: ctlplane
pacemaker_network: ctlplane
pacemaker_remote_network: ctlplane
placement_network: ctlplane
public_network: ctlplane
qdr_network: ctlplane
rabbitmq_network: ctlplane
redis_network: ctlplane
sahara_api_network: ctlplane
snmpd_network: ctlplane
standalone_hostname_resolve_network: ctlplane
swift_proxy_network: ctlplane
swift_storage_network: ctlplane
tacker_api_network: ctlplane
zaqar_api_network: ctlplane
tripleo_role_name: Standalone
validate_controllers_icmp: true
validate_fqdn: false
validate_gateways_icmp: true
validate_ntp: true
Standalone:
hosts:
centos: {}
Example ansible_hieradata playbook¶
- name: Converge
hosts: all
pre_tasks:
- name: Create puppet hieradata directory
file:
path: /etc/puppet/hieradata
state: directory
tasks:
- name: Create ansible_managed.json
include_role:
name: tripleo_hieradata
tasks_from: ansible_hieradata.yml
- name: Check file exists
when:
- not ansible_check_mode|bool
block:
- name: Stat file
stat:
path: /etc/puppet/hieradata/ansible_managed.json
become: true
register: _managed_file
- name: Assert file exists
assert:
that:
- _managed_file.stat.exists
- name: Check file contents
when:
- not ansible_check_mode|bool
block:
- name: Get contents
slurp:
src: /etc/puppet/hieradata/ansible_managed.json
become: true
register: _managed_file
- name: Set contents fact
set_fact:
_data: "{{ _managed_file['content'] | b64decode }}"
- name: Assert file contents
assert:
that:
- _data == {}
- name: Configure data
include_role:
name: tripleo_hieradata
tasks_from: ansible_hieradata.yml
vars:
hieradata_ansible_data:
my_var: foo
- name: Check file contents
when:
- not ansible_check_mode|bool
block:
- name: Get contents
slurp:
src: /etc/puppet/hieradata/ansible_managed.json
become: true
register: _managed_file
- name: Set contents fact
set_fact:
_data: "{{ _managed_file['content'] | b64decode }}"
- name: Set expected
set_fact:
expected:
my_var: foo
- name: Assert file contents
assert:
that:
- _data == expected
Scenario: default¶
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
Example default playbook¶
- name: Converge
hosts: all
roles:
- role: tripleo_hieradata
Scenario: hieradata_vars¶
Molecule Inventory¶
hosts:
all:
hosts:
centos:
ansible_python_interpreter: /usr/bin/python3
vars:
all_nodes_extra_map_data: {}
cloud_domain: localdomain
cloud_names:
cloud_name_ctlplane: standalone.ctlplane.localdomain
container_cli: podman
control_virtual_ip: 192.168.24.1
ctlplane_ip: 192.168.24.2
ctlplane_subnet_cidr: 24
deploy_artifact_urls: ''
deploy_identifier: '1564455089'
deploy_steps_max: 6
enable_internal_tls: false
enabled_networks: []
enabled_services:
- keystone_admin_api
- keystone_public_api
- ca_certs
- ceph_client
- ceph_mds
- ceph_mgr
- ceph_mon
- ceph_rgw
- ceph_osd
- certmonger_user
- clustercheck
- container_image_prepare
- logrotate_crond
- docker
- docker_registry
- glance_api
- haproxy
- iscsid
- kernel
- keystone
- manila_api
- manila_backend_cephfs
- manila_scheduler
- manila_share
- memcached
- mysql
- mysql_client
- neutron_api
- neutron_plugin_ml2_ovn
- nova_api
- nova_compute
- nova_conductor
- nova_libvirt
- nova_metadata
- nova_migration_target
- nova_scheduler
- nova_vnc_proxy
- ovn_controller
- ovn_dbs
- ovn_metadata
- openstack_clients
- oslo_messaging_notify
- oslo_messaging_rpc
- pacemaker
- placement
- podman
- snmp
- sshd
- chrony
- timezone
- logrotate_tmpwatch
- tripleo_firewall
- tripleo_packages
- tuned
extraconfig:
foo: bar1
foo2: bar2
hosts_entry: "\n192.168.24.1 standalone.localdomain standalone\n192.168.24.1\
\ standalone.ctlplane.localdomain standalone.ctlplane\n"
net_vip_map:
ctlplane: 192.168.24.1
ctlplane_subnet: 192.168.24.1/24
ctlplane_uri: 192.168.24.1
redis: 192.168.24.1
ovn_dbs: 192.168.24.1
network_virtual_ips:
ctlplane:
index: 1
ip_address: 192.168.24.1
network_cidrs:
External_cidr: 192.168.24.2/24
networks:
nova_additional_cell: false
ping_test_ips:
Standalone: 192.168.24.1
primary_role_name: Standalone
role_networks:
- Internal
service_configs:
foo: bar3
service_names:
- ca_certs
- ceph_client
- ceph_mds
- ceph_mgr
- ceph_mon
- ceph_rgw
- ceph_osd
- certmonger_user
- clustercheck
- container_image_prepare
- logrotate_crond
- docker
- docker_registry
- glance_api
- haproxy
- iscsid
- kernel
- keystone
- manila_api
- manila_backend_cephfs
- manila_scheduler
- manila_share
- memcached
- mysql
- mysql_client
- neutron_api
- neutron_plugin_ml2_ovn
- nova_api
- nova_compute
- nova_conductor
- nova_libvirt
- nova_metadata
- nova_migration_target
- nova_scheduler
- nova_vnc_proxy
- ovn_controller
- ovn_dbs
- ovn_metadata
- openstack_clients
- oslo_messaging_notify
- oslo_messaging_rpc
- pacemaker
- placement
- podman
- snmp
- sshd
- chrony
- timezone
- logrotate_tmpwatch
- tripleo_firewall
- tripleo_packages
- tuned
service_net_map:
aodh_api_network: ctlplane
apache_network: ctlplane
barbican_api_network: ctlplane
bindnetwork: ctlplane
ceph_cluster_network: ctlplane
ceph_dashboard_network: ctlplane
ceph_grafana_network: ctlplane
ceph_mon_network: ctlplane
ceph_rgw_network: ctlplane
cinder_api_network: ctlplane
cinder_iscsi_network: ctlplane
designate_api_network: ctlplane
docker_registry_network: ctlplane
ec2_api_metadata_network: ctlplane
ec2_api_network: ctlplane
etcd_network: ctlplane
ganesha_network: ctlplane
glance_api_network: ctlplane
gnocchi_api_network: ctlplane
haproxy_network: ctlplane
heat_api_cfn_network: ctlplane
heat_api_cloudwatch_network: ctlplane
heat_api_network: ctlplane
horizon_network: ctlplane
internal_api_network: ctlplane
ironic_api_network: ctlplane
ironic_inspector_network: ctlplane
ironic_network: ctlplane
keystone_admin_api_network: ctlplane
keystone_public_api_network: ctlplane
manila_api_network: ctlplane
memcached_network: ctlplane
metrics_qdr_network: ctlplane
mistral_api_network: ctlplane
mongodb_network: ctlplane
mysql_network: ctlplane
neutron_api_network: ctlplane
neutron_tenant_network: ctlplane
nova_api_network: ctlplane
nova_libvirt_network: ctlplane
nova_metadata_network: ctlplane
nova_vnc_proxy_network: ctlplane
novajoin_network: ctlplane
octavia_api_network: ctlplane
openshift_infra_network: ctlplane
openshift_master_network: ctlplane
oslo_messaging_notify_network: ctlplane
oslo_messaging_rpc_network: ctlplane
ovn_dbs_network: ctlplane
pacemaker_network: ctlplane
pacemaker_remote_network: ctlplane
placement_network: ctlplane
public_network: ctlplane
qdr_network: ctlplane
rabbitmq_network: ctlplane
redis_network: ctlplane
sahara_api_network: ctlplane
snmpd_network: ctlplane
standalone_hostname_resolve_network: ctlplane
swift_proxy_network: ctlplane
swift_storage_network: ctlplane
tacker_api_network: ctlplane
zaqar_api_network: ctlplane
tripleo_role_name: Standalone
validate_controllers_icmp: true
validate_fqdn: false
validate_gateways_icmp: true
validate_ntp: true
Standalone:
hosts:
centos:
datacentre: bb:bb:bb:bb:bb:bb
Example hieradata_vars playbook¶
- name: Converge
hosts: all
pre_tasks:
- name: Create puppet hieradata directory
file:
path: /etc/puppet/hieradata
state: directory
- name: Set mock network ip facts
set_fact:
CTRLPlane_ip: 192.168.24.2
ctlplane_ip: 192.168.24.2
Internal_ip: 192.168.25.2
tasks:
- name: Create hieradata from templates
include_role:
name: tripleo_hieradata
tasks_from: hieradata_vars.yaml
vars:
hieradata_templates_list:
- all_nodes
- bootstrap_node
- cloud_domain
- extraconfig
- fqdn
- net_ip_map
- service_configs
- service_names
- vip_data
- ovn_chassis_mac_map