From f00b97e48e4fa6ab5905dfc909c9e129a4f86e2e Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Mon, 24 Jun 2013 21:27:04 +0000 Subject: [PATCH] Setup basic postgresql server and add a db-aarch64 to test with. --- inventory/group_vars/postgresql-server | 10 ++++ .../host_vars/db-aarch64.qa.fedoraproject.org | 10 ++++ inventory/inventory | 3 ++ playbooks/groups/postgresl-server.yml | 51 +++++++++++++++++++ tasks/postgresql_server.yml | 20 ++++++++ 5 files changed, 94 insertions(+) create mode 100644 inventory/group_vars/postgresql-server create mode 100644 inventory/host_vars/db-aarch64.qa.fedoraproject.org create mode 100644 playbooks/groups/postgresl-server.yml create mode 100644 tasks/postgresql_server.yml diff --git a/inventory/group_vars/postgresql-server b/inventory/group_vars/postgresql-server new file mode 100644 index 0000000000..c1b52cc4e8 --- /dev/null +++ b/inventory/group_vars/postgresql-server @@ -0,0 +1,10 @@ +--- +# common items for the releng-* boxes +lvm_size: 50000 +mem_size: 8192 +num_cpus: 4 +# for systems that do not match the above - specify the same parameter in +# the host_vars/$hostname file + +tcp_ports: [ 80 ] +fas_client_groups: sysadmin-noc diff --git a/inventory/host_vars/db-aarch64.qa.fedoraproject.org b/inventory/host_vars/db-aarch64.qa.fedoraproject.org new file mode 100644 index 0000000000..07a816ae67 --- /dev/null +++ b/inventory/host_vars/db-aarch64.qa.fedoraproject.org @@ -0,0 +1,10 @@ +--- +nm: 255.255.255.0 +gw: 10.5.126.254 +dns: 10.5.126.21 +ks_url: http://10.5.126.23/repo/rhel/ks/kvm-rhel-6 +ks_repo: http://10.5.126.23/repo/rhel/RHEL6-x86_64/ +volgroup: /dev/VirtGuests +eth0_ip: 10.5.124.148 +vmhost: virthost-comm02.qa.fedoraproject.org +datacenter: phx2 diff --git a/inventory/inventory b/inventory/inventory index fc667893d1..56ec67df13 100644 --- a/inventory/inventory +++ b/inventory/inventory @@ -151,6 +151,9 @@ db-fas01.phx2.fedoraproject.org db-fas01.stg.phx2.fedoraproject.org db02.stg.phx2.fedoraproject.org +[dbserver-secondary] +db-aarch64.qa.fedoraproject.org + [dev] fas01.dev.fedoraproject.org survey01.dev.fedoraproject.org diff --git a/playbooks/groups/postgresl-server.yml b/playbooks/groups/postgresl-server.yml new file mode 100644 index 0000000000..d95801dd73 --- /dev/null +++ b/playbooks/groups/postgresl-server.yml @@ -0,0 +1,51 @@ +# create a new database server system +# NOTE: should be used with --limit most of the time +# NOTE: most of these vars come from group_vars/backup_server or from hostvars + +- name: make postgresql-server + hosts: dbserver-secondary + user: root + gather_facts: False + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - ${private}/vars.yml + - ${vars}/${ansible_distribution}.yml + + tasks: + - include: $tasks/virt_instance_create.yml + + handlers: + - include: $handlers/restart_services.yml + +# Once the instance exists, configure it. + +- name: make db server system + hosts: dbserver-secondary + user: root + gather_facts: True + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - ${private}/vars.yml + - ${vars}/${ansible_distribution}.yml + + tasks: + tasks: + - include: $tasks/hosts.yml + - include: $tasks/yumrepos.yml + - include: $tasks/base.yml + - include: $tasks/fas_client.yml + - include: $tasks/2fa_client.yml + - include: $tasks/motd.yml + - include: $tasks/sudo.yml + - include: $tasks/rkhunter.yml + - include: $tasks/denyhosts.yml + - include: $tasks/nagios_client.yml + - include: $tasks/collectd/client.yml + - include: $tasks/postgresql_server.yml + +# TODO: add iscsi task + + handlers: + - include: $handlers/restart_services.yml diff --git a/tasks/postgresql_server.yml b/tasks/postgresql_server.yml new file mode 100644 index 0000000000..f10955a05d --- /dev/null +++ b/tasks/postgresql_server.yml @@ -0,0 +1,20 @@ +--- +# +# Setup postgresql server. +# +- name: install postgresql server packages + yum: name=$item state=installed + with_items: + - postgresql-server + - postgresql-contrib + - postgresql-plpython + tags: + - packages + +- name: Set postgresql-server to run on boot + service: name=postgresql enabled=yes + ignore_errors: true + notify: + - restart postgresql + tags: + - service