From 5e5b3f76218195b968727a3cdf0e0e982500a933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pep=20Turr=C3=B3=20Mauri?= Date: Fri, 16 Oct 2015 20:01:17 +0200 Subject: RH subscription: optional satellite and pkg update Add an optional rhel_subscription_server fact to configure RHSM registration to a Red Hat Satellite server. --- roles/rhel_subscribe/tasks/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml index 8fb2fc042..30c0920a1 100644 --- a/roles/rhel_subscribe/tasks/main.yml +++ b/roles/rhel_subscribe/tasks/main.yml @@ -6,19 +6,26 @@ - set_fact: rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}" rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}" + rhel_subscription_server: "{{ lookup('oo_option', 'rhel_subscription_server') | default(rhsub_server) }}" - fail: msg: "This role is only supported for Red Hat hosts" when: ansible_distribution != 'RedHat' - fail: - msg: Either rsub_user or the rhel_subscription_user env variable are required for this role. + msg: Either rhsub_user or the rhel_subscription_user env variable are required for this role. when: rhel_subscription_user is not defined - fail: - msg: Either rsub_pass or the rhel_subscription_pass env variable are required for this role. + msg: Either rhsub_pass or the rhel_subscription_pass env variable are required for this role. when: rhel_subscription_pass is not defined +- name: Satellite preparation + command: "rpm -Uvh http://{{ rhel_subscription_server }}/pub/katello-ca-consumer-latest.noarch.rpm" + args: + creates: /etc/rhsm/ca/katello-server-ca.pem + when: rhel_subscription_server is defined and rhel_subscription_server + - name: RedHat subscriptions redhat_subscription: username: "{{ rhel_subscription_user }}" -- cgit v1.2.3 From 251dca6634e00fa58457611073ab6293468e3997 Mon Sep 17 00:00:00 2001 From: Tobias Florek Date: Wed, 11 Nov 2015 09:20:56 +0100 Subject: remove netaddr dependency --- roles/openshift_facts/library/openshift_facts.py | 21 +++++++++++++++++++-- roles/openshift_facts/tasks/main.yml | 3 +-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index c108cd422..9a5d36643 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -24,8 +24,25 @@ import StringIO import yaml from distutils.util import strtobool from distutils.version import LooseVersion -from netaddr import IPNetwork +import struct +import socket +def first_ip(network): + """ Return the first IPv4 address in network + + Args: + network (str): network in CIDR format + Returns: + str: first IPv4 address + """ + def atoi(addr): + return struct.unpack("!I", socket.inet_aton(addr))[0] + def itoa(addr): + return socket.inet_ntoa(struct.pack("!I", addr)) + + (address, netmask) = network.split('/') + netmask_i = (0xffffffff << (32 - atoi(netmask))) & 0xffffffff + return itoa((atoi(address) & netmask_i) + 1) def hostname_valid(hostname): """ Test if specified hostname should be considered valid @@ -525,7 +542,7 @@ def set_aggregate_facts(facts): 'kubernetes.default.svc', 'kubernetes.default.svc.' + cluster_domain] all_hostnames.update(svc_names) internal_hostnames.update(svc_names) - first_svc_ip = str(IPNetwork(facts['master']['portal_net'])[1]) + first_svc_ip = first_ip(facts['master']['portal_net']) all_hostnames.add(first_svc_ip) internal_hostnames.add(first_svc_ip) _add_etcd_data_dir_fact(facts) diff --git a/roles/openshift_facts/tasks/main.yml b/roles/openshift_facts/tasks/main.yml index a28aa7ba2..913f0dc78 100644 --- a/roles/openshift_facts/tasks/main.yml +++ b/roles/openshift_facts/tasks/main.yml @@ -6,10 +6,9 @@ - ansible_version | version_compare('1.9.0', 'ne') - ansible_version | version_compare('1.9.0.1', 'ne') -- name: Ensure python-netaddr and PyYaml are installed +- name: Ensure PyYaml is installed yum: pkg={{ item }} state=installed with_items: - - python-netaddr - PyYAML - name: Gather Cluster facts -- cgit v1.2.3 From 15c70ef6da8f63ad9c29ee67328795a2232e6371 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Thu, 12 Nov 2015 11:58:57 -0500 Subject: Dependencies need to be added when a create occurs on SLA object. --- roles/lib_zabbix/library/zbx_itservice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/lib_zabbix/library/zbx_itservice.py b/roles/lib_zabbix/library/zbx_itservice.py index 37aea1494..a5ee97e15 100644 --- a/roles/lib_zabbix/library/zbx_itservice.py +++ b/roles/lib_zabbix/library/zbx_itservice.py @@ -183,7 +183,7 @@ def main(): if not exists(content): module.exit_json(changed=False, state="absent") - content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0]['itemid']]) + content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0]['serviceid']]) module.exit_json(changed=True, results=content['result'], state="absent") # Create and Update @@ -210,6 +210,7 @@ def main(): if content.has_key('error'): module.exit_json(failed=True, changed=True, results=content['error'], state="present") + if dependencies: content = add_dependencies(zapi, module.params['name'], dependencies) if content.has_key('error'): -- cgit v1.2.3 From 133bea98b62718fbc23d3c1f74e22665b5293603 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 13 Nov 2015 14:55:01 -0500 Subject: Update etcd default facts setting --- roles/openshift_facts/library/openshift_facts.py | 49 +++++++++++++++--------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index ae530eadd..192c3c4bc 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -560,8 +560,10 @@ def set_etcd_facts_if_unset(facts): If anything goes wrong parsing these, the fact will not be set. """ - if 'etcd' in facts: - if 'master' in facts and facts['master']['embedded_etcd']: + if 'master' in facts and facts['master']['embedded_etcd']: + etcd_facts = facts['etcd'] if 'etcd' in facts else dict() + + if 'etcd_data_dir' not in etcd_facts: try: # Parse master config to find actual etcd data dir: master_cfg_path = os.path.join(facts['common']['config_base'], @@ -570,28 +572,37 @@ def set_etcd_facts_if_unset(facts): config = yaml.safe_load(master_cfg_f.read()) master_cfg_f.close() - facts['etcd']['etcd_data_dir'] = \ + etcd_facts['etcd_data_dir'] = \ config['etcdConfig']['storageDirectory'] + + facts['etcd'] = etcd_facts + # We don't want exceptions bubbling up here: # pylint: disable=broad-except except Exception: pass - else: - # Read ETCD_DATA_DIR from /etc/etcd/etcd.conf: - try: - # Add a fake section for parsing: - ini_str = '[root]\n' + open('/etc/etcd/etcd.conf', 'r').read() - ini_fp = StringIO.StringIO(ini_str) - config = ConfigParser.RawConfigParser() - config.readfp(ini_fp) - etcd_data_dir = config.get('root', 'ETCD_DATA_DIR') - if etcd_data_dir.startswith('"') and etcd_data_dir.endswith('"'): - etcd_data_dir = etcd_data_dir[1:-1] - facts['etcd']['etcd_data_dir'] = etcd_data_dir - # We don't want exceptions bubbling up here: - # pylint: disable=broad-except - except Exception: - pass + else: + etcd_facts = facts['etcd'] if 'etcd' in facts else dict() + + # Read ETCD_DATA_DIR from /etc/etcd/etcd.conf: + try: + # Add a fake section for parsing: + ini_str = '[root]\n' + open('/etc/etcd/etcd.conf', 'r').read() + ini_fp = StringIO.StringIO(ini_str) + config = ConfigParser.RawConfigParser() + config.readfp(ini_fp) + etcd_data_dir = config.get('root', 'ETCD_DATA_DIR') + if etcd_data_dir.startswith('"') and etcd_data_dir.endswith('"'): + etcd_data_dir = etcd_data_dir[1:-1] + + etcd_facts['etcd_data_dir'] = etcd_data_dir + facts['etcd'] = etcd_facts + + # We don't want exceptions bubbling up here: + # pylint: disable=broad-except + except Exception: + pass + return facts def set_deployment_facts_if_unset(facts): -- cgit v1.2.3 From 61adeef4c94eada5182539cf30c55c4b31534bf9 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Fri, 13 Nov 2015 15:09:15 -0500 Subject: pylint openshift_facts --- roles/openshift_facts/library/openshift_facts.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 192c3c4bc..091ba4e2b 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -35,10 +35,8 @@ def first_ip(network): Returns: str: first IPv4 address """ - def atoi(addr): - return struct.unpack("!I", socket.inet_aton(addr))[0] - def itoa(addr): - return socket.inet_ntoa(struct.pack("!I", addr)) + atoi = lambda addr: struct.unpack("!I", socket.inet_aton(addr))[0] + itoa = lambda addr: socket.inet_ntoa(struct.pack("!I", addr)) (address, netmask) = network.split('/') netmask_i = (0xffffffff << (32 - atoi(netmask))) & 0xffffffff -- cgit v1.2.3 From 19f34554b6dbee62070ab147e790d21d6e759cca Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Fri, 13 Nov 2015 17:07:49 -0500 Subject: added the tito and copr_cli roles --- roles/copr_cli/README.md | 38 ++++++++++++++++++++++++++++++++++++++ roles/copr_cli/defaults/main.yml | 2 ++ roles/copr_cli/handlers/main.yml | 2 ++ roles/copr_cli/meta/main.yml | 14 ++++++++++++++ roles/copr_cli/tasks/main.yml | 4 ++++ roles/copr_cli/vars/main.yml | 2 ++ roles/tito/README.md | 38 ++++++++++++++++++++++++++++++++++++++ roles/tito/defaults/main.yml | 2 ++ roles/tito/handlers/main.yml | 2 ++ roles/tito/meta/main.yml | 14 ++++++++++++++ roles/tito/tasks/main.yml | 4 ++++ roles/tito/vars/main.yml | 2 ++ 12 files changed, 124 insertions(+) create mode 100644 roles/copr_cli/README.md create mode 100644 roles/copr_cli/defaults/main.yml create mode 100644 roles/copr_cli/handlers/main.yml create mode 100644 roles/copr_cli/meta/main.yml create mode 100644 roles/copr_cli/tasks/main.yml create mode 100644 roles/copr_cli/vars/main.yml create mode 100644 roles/tito/README.md create mode 100644 roles/tito/defaults/main.yml create mode 100644 roles/tito/handlers/main.yml create mode 100644 roles/tito/meta/main.yml create mode 100644 roles/tito/tasks/main.yml create mode 100644 roles/tito/vars/main.yml (limited to 'roles') diff --git a/roles/copr_cli/README.md b/roles/copr_cli/README.md new file mode 100644 index 000000000..edc68454e --- /dev/null +++ b/roles/copr_cli/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +This role manages Copr CLI. + +https://apps.fedoraproject.org/packages/copr-cli/ + +Requirements +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + + - hosts: servers + roles: + - role: copr_cli + +License +------- + +Apache License, Version 2.0 + +Author Information +------------------ + +Thomas Wiest diff --git a/roles/copr_cli/defaults/main.yml b/roles/copr_cli/defaults/main.yml new file mode 100644 index 000000000..3b8adf910 --- /dev/null +++ b/roles/copr_cli/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for copr_cli diff --git a/roles/copr_cli/handlers/main.yml b/roles/copr_cli/handlers/main.yml new file mode 100644 index 000000000..c3dec5a4c --- /dev/null +++ b/roles/copr_cli/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for copr_cli diff --git a/roles/copr_cli/meta/main.yml b/roles/copr_cli/meta/main.yml new file mode 100644 index 000000000..f050281fd --- /dev/null +++ b/roles/copr_cli/meta/main.yml @@ -0,0 +1,14 @@ +--- +galaxy_info: + author: Thomas Wiest + description: Manages Copr CLI + company: Red Hat + license: Apache License, Version 2.0 + min_ansible_version: 1.2 + platforms: + - name: EL + versions: + - 7 + categories: + - packaging +dependencies: [] diff --git a/roles/copr_cli/tasks/main.yml b/roles/copr_cli/tasks/main.yml new file mode 100644 index 000000000..f7ef1c26e --- /dev/null +++ b/roles/copr_cli/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- yum: + name: copr-cli + state: present diff --git a/roles/copr_cli/vars/main.yml b/roles/copr_cli/vars/main.yml new file mode 100644 index 000000000..1522c94d9 --- /dev/null +++ b/roles/copr_cli/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for copr_cli diff --git a/roles/tito/README.md b/roles/tito/README.md new file mode 100644 index 000000000..c4e2856dc --- /dev/null +++ b/roles/tito/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +This role manages Tito. + +https://github.com/dgoodwin/tito + +Requirements +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + + - hosts: servers + roles: + - role: tito + +License +------- + +Apache License, Version 2.0 + +Author Information +------------------ + +Thomas Wiest diff --git a/roles/tito/defaults/main.yml b/roles/tito/defaults/main.yml new file mode 100644 index 000000000..dd7cd269e --- /dev/null +++ b/roles/tito/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for tito diff --git a/roles/tito/handlers/main.yml b/roles/tito/handlers/main.yml new file mode 100644 index 000000000..e9ce609d5 --- /dev/null +++ b/roles/tito/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for tito diff --git a/roles/tito/meta/main.yml b/roles/tito/meta/main.yml new file mode 100644 index 000000000..fb121c08e --- /dev/null +++ b/roles/tito/meta/main.yml @@ -0,0 +1,14 @@ +--- +galaxy_info: + author: Thomas Wiest + description: Manages Tito + company: Red Hat + license: Apache License, Version 2.0 + min_ansible_version: 1.2 + platforms: + - name: EL + versions: + - 7 + categories: + - packaging +dependencies: [] diff --git a/roles/tito/tasks/main.yml b/roles/tito/tasks/main.yml new file mode 100644 index 000000000..f7b4ef363 --- /dev/null +++ b/roles/tito/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- yum: + name: tito + state: present diff --git a/roles/tito/vars/main.yml b/roles/tito/vars/main.yml new file mode 100644 index 000000000..8a1aafc41 --- /dev/null +++ b/roles/tito/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for tito -- cgit v1.2.3 From 1bce57de67a5e576b61fb7d6bddb132912c4b289 Mon Sep 17 00:00:00 2001 From: Joel Diaz Date: Mon, 16 Nov 2015 11:12:58 -0500 Subject: Raise lifetime to 2 weeks for dynamic AWS items --- roles/os_zabbix/vars/template_aws.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/os_zabbix/vars/template_aws.yml b/roles/os_zabbix/vars/template_aws.yml index 0ed682128..57832a3fe 100644 --- a/roles/os_zabbix/vars/template_aws.yml +++ b/roles/os_zabbix/vars/template_aws.yml @@ -4,7 +4,7 @@ g_template_aws: zdiscoveryrules: - name: disc.aws key: disc.aws - lifetime: 1 + lifetime: 14 description: "Dynamically register AWS bucket info" zitemprototypes: -- cgit v1.2.3