Skip to content

Commit

Permalink
updated etcd_install and k8s_master_install at migrating k8s-9.91 to …
Browse files Browse the repository at this point in the history
…k8s-10.21.
  • Loading branch information
gitbeyond committed Oct 26, 2020
1 parent cfa0a9f commit ce09c58
Show file tree
Hide file tree
Showing 28 changed files with 164 additions and 81 deletions.
3 changes: 2 additions & 1 deletion dockerFiles/ingress-nginx-controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
FROM k8s.gcr.io/ingress-nginx/controller:v0.35.0
#FROM k8s.gcr.io/ingress-nginx/controller:v0.35.0
FROM k8s.gcr.io/ingress-nginx/controller:v0.40.2
33 changes: 19 additions & 14 deletions etcd_install/tasks/create_etcd_dir.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
- name: create etcd dir
file:
path: '{{ item.path }}'
owner: '{{ item.owner }}'
group: '{{ item.group }}'
mode: '{{ item.mode }}'
owner: '{{ item.owner | default(etcd_run_user, true) }}'
group: '{{ item.group | default(etcd_run_user, true) }}'
mode: '{{ item.mode | default("0755", true)}}'
state: directory
with_items:
- { path: "{{app_base_dir}}", owner: root, group: root, mode: "0755" }
- { path: "{{etcd_log_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_data_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_data_dir}}/{{etcd_name}}.etcd", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_data_dir}}/wal", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_var_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_conf_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755" }
- { path: "{{etcd_conf_dir}}/ssl", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755"}
- { path: "{{script_deploy_dir}}", owner: 'root', group: 'root', mode: "0755"}
- { path: "{{etcd_backup_dir}}", owner: '{{etcd_run_user}}', group: '{{etcd_run_user}}', mode: "0755"}
loop:
- path: "{{app_base_dir}}"
owner: root
group: root
mode: "0755"
- path: "{{etcd_log_dir}}"
- path: "{{etcd_data_dir}}"
- path: "{{etcd_data_dir}}/{{etcd_name}}.etcd"
mode: "0700"
- path: "{{etcd_data_dir}}/wal"
mode: "0700"
- path: "{{etcd_var_dir}}"
- path: "{{etcd_conf_dir}}"
- path: "{{etcd_conf_dir}}/ssl"
- path: "{{script_deploy_dir}}"
- path: "{{etcd_backup_dir}}"
24 changes: 9 additions & 15 deletions etcd_install/tasks/etcd_install/install_etcd_for_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,24 @@

- name: cp and unarchive etcd_binary_tarball to remote host
unarchive:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
src: '{{ etcd_packet }}'
dest: '{{ etcd_install_dir }}'
owner: '{{ etcd_run_user }}'
group: '{{ etcd_run_user }}'
creates: '{{ item.creates }}'
creates: '{{ etcd_install_dir }}/{{etcd_dir_name.stdout }}'
mode: "0755"
loop:
- { src: '{{etcd_packet}}', dest: '{{ etcd_install_dir}}/', creates: '{{ etcd_install_dir }}/{{etcd_dir_name.stdout}}' }

- name: create etcd link dir
file:
src: '{{ item.src }}'
dest: '{{item.dest}}'
state: '{{ item.state }}'
with_items:
- { src: "{{app_base_dir}}/{{etcd_dir_name.stdout}}", dest: '{{etcd_base_dir}}', state: link}
src: '{{ etcd_install_dir}}/{{etcd_dir_name.stdout }}'
dest: '{{etcd_base_dir}}'
state: 'link'
when: etcd_dir_name.stdout != "etcd"

- name: create etcd conf dir link
file:
src: '{{ item.src }}'
dest: '{{item.dest}}'
state: '{{ item.state }}'
with_items:
- { src: "{{etcd_conf_dir}}", dest: '/etc/etcd', state: link}
src: '{{ etcd_conf_dir }}'
dest: '/etc/etcd'
state: 'link'
ignore_errors: true

61 changes: 52 additions & 9 deletions etcd_install/tasks/generate_certs.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@

- name: generate etcd-root-ca
local_action: shell {{etcd_cfssl_cmd_path}}/cfssl gencert -initca {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca
args:
chdir: "{{etcd_work_dir}}"
#creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-root-ca.pem"
creates: "{{etcd_cert_dir}}/etcd-root-ca.pem"
local_action:
module: shell
#cmd: '{{etcd_cfssl_cmd_path}}/cfssl gencert -initca {{"-ca-key "~etcd_cert_dir~"/etcd-root-ca-key.pem" if etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-key.pem" is exists else ""}} {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca'
#cmd: '{{etcd_cfssl_cmd_path}}/cfssl gencert -initca {%if "/data/apps/data/wanghaifeng/ansible/playbooks/k8s_91"~etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-key.pem" is exists%}{{"-ca-key "~etcd_cert_dir~"/etcd-root-ca-key.pem"}}{%endif%} {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca'
#cmd: '{{etcd_cfssl_cmd_path}}/cfssl gencert -initca {%if "/data/apps/data/wanghaifeng/ansible/playbooks/k8s_91"~etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-key.pem" is exists%}-ca-key {{etcd_cert_dir}}/etcd-root-ca-key.pem{%endif%} {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca'
#cmd: 'echo {%if etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-key.pem" is exists%}"/etc/fstab"{%else%}"hehe"{%endif%}'
#cmd: 'echo {{ "/data/apps/data/wanghaifeng/ansible/playbooks/k8s_91/"~etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-key.pem" }}'
#cmd: 'echo {% if "/data/apps/data/wanghaifeng/ansible/playbooks/k8s_91/"~etcd_work_dir~"/"~etcd_cert_dir~"/etcd-root-ca-keyss.pem" is exists %}haha{%endif%}'
cmd: |
if [ -e '{{ etcd_cert_dir~"/etcd-root-ca-key.pem" }}' ];then
echo 'cfssl gencert -initca -ca-key {{etcd_cert_dir~"/etcd-root-ca-key.pem"}} {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca'
cfssl gencert -initca -ca-key {{etcd_cert_dir~"/etcd-root-ca-key.pem"}} {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca
else
echo 'cfssl gencert -initca {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca'
cfssl gencert -initca {{etcd_cert_json_dir}}/etcd-root-ca-csr.json | cfssljson --bare {{etcd_cert_dir}}/etcd-root-ca
fi
args:
chdir: "{{etcd_work_dir}}"
#creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/etcd-root-ca.pem"
creates: "{{etcd_cert_dir}}/etcd-root-ca.pem"
run_once: true
environment:
PATH: '{{etcd_cfssl_cmd_path}}:{{ansible_env.PATH}}'

#- name: test env
# local_action:
# module: shell
# cmd: echo $PATH
# environment:
# PATH: '{{etcd_cfssl_cmd_path}}:{{ansible_env.PATH}}'

#- meta: end_play

- name: generate etcd certs
local_action: shell {{etcd_cfssl_cmd_path}}/cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config={{etcd_cert_json_dir}}/etcd-ca-config.json -profile={{item.split('-')[1]}} {{etcd_cert_json_dir}}/{{item}}-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/{{item}}
args:
chdir: "{{etcd_work_dir}}"
local_action:
module: shell
#cmd: "{{etcd_cfssl_cmd_path}}/cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config={{etcd_cert_json_dir}}/etcd-ca-config.json -profile={{item.split('-')[1]}} {{etcd_cert_json_dir}}/{{item}}-csr.json | {{etcd_cfssl_cmd_path}}/cfssljson --bare {{etcd_cert_dir}}/{{item}}"
cmd: |
if [ -e '{{ etcd_cert_dir~"/"~item~"-key.pem" }}' ];then
# 如果 key 存在,那么先根据 key 生成 csr, 然后通过 sign 命令签署证书
#cfssl gencsr -key ../ansible_etcd_certs/etcd-key.pem etcd-csr.json > /tmp/etcd.csr
csr_strings=$(cfssl gencsr -key {{etcd_cert_dir~"/"~item~"-key.pem"}} {{etcd_cert_json_dir}}/{{item}}-csr.json | awk -F':' '{split($2,A,"\"");print A[2]}')
echo -e ${csr_strings} | grep -v '^$' > {{etcd_cert_dir}}/{{item}}.csr
cat {{etcd_cert_dir}}/{{item}}.csr | cfssl sign -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config={{etcd_cert_json_dir}}/etcd-ca-config.json -profile={{item.split('-')[1]}} - | cfssljson -bare {{etcd_cert_dir}}/{{item}}
# cat /tmp/etcd.csr |cfssl sign -ca etcd-root-ca.pem -ca-key etcd-root-ca-key.pem -config ../ansible_certs_json/etcd-ca-config.json --profile server - | cfssljson -bare /tmp/etcd
#2020/10/22 14:02:24 [INFO] signed certificate with serial number 292409825673861649077494967297457537903606409692
else
cfssl gencert -ca={{etcd_cert_dir}}/etcd-root-ca.pem -ca-key={{etcd_cert_dir}}/etcd-root-ca-key.pem -config={{etcd_cert_json_dir}}/etcd-ca-config.json -profile={{item.split('-')[1]}} {{etcd_cert_json_dir}}/{{item}}-csr.json | cfssljson --bare {{etcd_cert_dir}}/{{item}}
fi
args:
chdir: "{{etcd_work_dir}}"
#creates: "{{etcd_work_dir}}/{{etcd_cert_dir}}/{{item}}.pem"
creates: "{{etcd_cert_dir}}/{{item}}.pem"
creates: "{{etcd_cert_dir}}/{{item}}.pem"
loop:
- etcd-client-ca
- etcd-member-ca
- etcd-server-ca
run_once: true
environment:
PATH: '{{etcd_cfssl_cmd_path}}:{{ansible_env.PATH}}'


#- name: generate etcd-server-ca
Expand Down
4 changes: 2 additions & 2 deletions k8s_master_install/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ k8s_master_packet:
#k8s_master_dir_name: "{{lookup('pipe', 'tar tf '+ k8s_master_packet).split('\n')[-1].split(' ')[-1].split('/')| first}}"
k8s_master_dir_name: "{{lookup('pipe', 'tar tf '+ k8s_master_packet).split('\n')[-1].split('/')| first}}"
k8s_work_dir: /root/k8s
k8s_cert_json_dir: certs_json
k8s_cert_json_dir: ansible_certs_json
k8s_work_conf_dir: ansible_k8s_confs
k8s_cert_dir: ansible_k8s_certs

Expand All @@ -41,7 +41,7 @@ k8s_cert_l: "Beijing"
k8s_cert_o: "k8s"
# tech. sa, dev
k8s_cert_ou: "System"
k8s_cert_conf_files: '{{q("fileglob", "templates/*.json")}}'
k8s_cert_conf_files: '{{q("fileglob", "templates/k8s_certs_json/*.json")}}'
k8s_cert_hosts:


Expand Down
4 changes: 2 additions & 2 deletions k8s_master_install/tasks/create_k8s_dir.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# editor: haifeng
# 2020/04/30
# editor: haifengsss@163.com
# 2019/04/30

- name: create k8s user
user:
Expand Down
61 changes: 47 additions & 14 deletions k8s_master_install/tasks/generate_k8s_certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@
- name: generate k8s-root-ca
local_action:
module: shell
cmd: '{{k8s_cfssl_cmd_path}}/cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | {{k8s_cfssl_cmd_path}}/cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca'
#cmd: 'cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca'
cmd: |
if [ -e '{{k8s_cert_dir}}/k8s-root-ca-key.pem' ];then
echo "$PATH"
echo 'cfssl gencert -initca -ca-key {{k8s_cert_dir}}/k8s-root-ca-key.pem {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca'
cfssl gencert -initca -ca-key {{k8s_cert_dir}}/k8s-root-ca-key.pem {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca
else
echo 'cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca'
cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-root-ca-csr.json | cfssljson --bare {{k8s_cert_dir}}/k8s-root-ca
fi
args:
chdir: "{{k8s_work_dir}}"
#creates: "{{k8s_work_dir}}/{{k8s_cert_dir}}/k8s-root-ca.pem"
creates: "{{k8s_cert_dir}}/k8s-root-ca.pem"
run_once: true
tags:
- generate_k8s_root_ca
environment:
PATH: '{{k8s_cfssl_cmd_path}}:{{ansible_env.PATH}}'

- name: generate kube-apiserver-ca kubernetes-admin kube-apiserver-kubelet-client
local_action:
module: shell
cmd: '{{k8s_cfssl_cmd_path}}/cfssl gencert -ca={{k8s_cert_dir}}/k8s-root-ca.pem -ca-key={{k8s_cert_dir}}/k8s-root-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes {{k8s_cert_json_dir}}/{{item}}-csr.json | {{k8s_cfssl_cmd_path}}/cfssljson --bare {{k8s_cert_dir}}/{{item}}'
#cmd: 'cfssl gencert -ca={{k8s_cert_dir}}/k8s-root-ca.pem -ca-key={{k8s_cert_dir}}/k8s-root-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes {{k8s_cert_json_dir}}/{{item}}-csr.json | cfssljson --bare {{k8s_cert_dir}}/{{item}}'
cmd: |
if [ -e '{{ k8s_cert_dir~"/"~item~"-key.pem" }}' ];then
csr_strings=$(cfssl gencsr -key {{k8s_cert_dir~"/"~item~"-key.pem"}} {{k8s_cert_json_dir}}/{{item}}-csr.json | awk -F':' '{split($2,A,"\"");print A[2]}')
echo -e ${csr_strings} | grep -v '^$' > {{k8s_cert_dir}}/{{item}}.csr
cat {{k8s_cert_dir}}/{{item}}.csr | cfssl sign -ca={{k8s_cert_dir}}/k8s-root-ca.pem -ca-key={{k8s_cert_dir}}/k8s-root-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes - | cfssljson -bare {{k8s_cert_dir}}/{{item}}
else
cfssl gencert -ca={{k8s_cert_dir}}/k8s-root-ca.pem -ca-key={{k8s_cert_dir}}/k8s-root-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes {{k8s_cert_json_dir}}/{{item}}-csr.json | cfssljson --bare {{k8s_cert_dir}}/{{item}}
fi
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/{{item}}.pem"
Expand All @@ -26,30 +45,44 @@
- k8s-kube-scheduler
- k8s-kube-proxy
- k8s-dashboard
- kubernetes
run_once: true
environment:
PATH: '{{k8s_cfssl_cmd_path}}:{{ansible_env.PATH}}'
#when: k8s_work_dir~"/"~k8s_cert_json_dir~"/"~item~"-csr.json" is exists

- name: generate k8s-front-proxy-ca
local_action: shell {{k8s_cfssl_cmd_path}}/cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-front-proxy-ca-csr.json | {{k8s_cfssl_cmd_path}}/cfssljson --bare {{k8s_cert_dir}}/k8s-front-proxy-ca
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/k8s-front-proxy-ca.pem"
local_action:
module: shell
cmd: '{{k8s_cfssl_cmd_path}}/cfssl gencert -initca {{k8s_cert_json_dir}}/k8s-front-proxy-ca-csr.json | {{k8s_cfssl_cmd_path}}/cfssljson --bare {{k8s_cert_dir}}/k8s-front-proxy-ca'
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/k8s-front-proxy-ca.pem"
run_once: true
environment:
PATH: '{{k8s_cfssl_cmd_path}}:{{ansible_env.PATH}}'

- name: generate k8s-front-proxy-client
local_action: shell {{k8s_cfssl_cmd_path}}/cfssl gencert -ca={{k8s_cert_dir}}/k8s-front-proxy-ca.pem -ca-key={{k8s_cert_dir}}/k8s-front-proxy-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes {{k8s_cert_json_dir}}/{{item}}-csr.json | {{k8s_cfssl_cmd_path}}/cfssljson --bare {{k8s_cert_dir}}/{{item}}
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/{{item}}.pem"
local_action:
module: shell
cmd: 'cfssl gencert -ca={{k8s_cert_dir}}/k8s-front-proxy-ca.pem -ca-key={{k8s_cert_dir}}/k8s-front-proxy-ca-key.pem -config={{k8s_cert_json_dir}}/k8s-gencert.json -profile=kubernetes {{k8s_cert_json_dir}}/{{item}}-csr.json | cfssljson --bare {{k8s_cert_dir}}/{{item}}'
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/{{item}}.pem"
loop:
- k8s-front-proxy-client
run_once: true
environment:
PATH: '{{k8s_cfssl_cmd_path}}:{{ansible_env.PATH}}'

# serviceAccount private key
- name: generate sa private.key
local_action: shell openssl genrsa -out {{k8s_cert_dir}}/k8s-sa.key 2048
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/k8s-sa.key"
local_action:
module: shell
cmd: openssl genrsa -out {{k8s_cert_dir}}/k8s-sa.key 2048
args:
chdir: "{{k8s_work_dir}}"
creates: "{{k8s_cert_dir}}/k8s-sa.key"
run_once: true

- name: generate sa public key
Expand Down
2 changes: 1 addition & 1 deletion k8s_master_install/tasks/install_k8s_master.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# edirtor: haifeng
# edirtor: haifengsss@163.com
# 2017/01/12

- name: get k8s_master packet dir name
Expand Down
2 changes: 1 addition & 1 deletion k8s_master_install/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# edirtor: haifeng
# editor: haifengsss@163.com
# 2017/01/12

- import_tasks: create_k8s_work_dir.yml
Expand Down
3 changes: 2 additions & 1 deletion mysql_binary_install/tasks/create_syncuser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- name: install MySQL-python packet
yum:
name:
- MySQL-python
#- MySQL-python
- python2-PyMySQL
state: latest

- name: rename ~/.my.cnf if exists
Expand Down
1 change: 1 addition & 0 deletions mysql_binary_install/tasks/install_mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
local_action:
module: shell
cmd: tar tf {{mysql_packet}} |head -n 1 |awk -F'/' '{print $1}'
warn: false
register: mysql_dir_name
run_once: true

Expand Down
2 changes: 1 addition & 1 deletion mysql_binary_install/tasks/sync_to_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
master_password: '{{mysql_master_sync_pass}}'
master_auto_position: 1
mode: '{{ item }}'
with_items:
loop:
- stopslave
- changemaster
- startslave
Expand Down
2 changes: 1 addition & 1 deletion mysql_mha_install/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ mysql_login_pass:
mysql_login_user:
mysql_sock:
mysql_vip:
mysql_mha_user:
mysql_mha_user: mha
mysql_mha_pass:
mysql_mha_priv: '*.*:all'

3 changes: 2 additions & 1 deletion mysql_user/tasks/create_mysql_app_users.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
- name: install MySQL-python packet
yum:
name:
- MySQL-python
#- MySQL-python
- python2-PyMySQL
state: latest
when: mysql_user_install_driver == True

Expand Down
5 changes: 4 additions & 1 deletion pmm-client_install/tasks/install_pmm_client_for_tgz.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

- name: get pmm_client packet dir name
local_action: shell tar tvf {{pmm_client_packet}} |tail -n 1 |awk '{print $NF}' |awk -F'/' '{print $1}'
local_action:
module: shell
cmd: tar tf {{pmm_client_packet}} | head -n 1 |awk -F'/' '{print $1}'
warn: false
register: packet_dir_name
run_once: true

Expand Down
35 changes: 18 additions & 17 deletions pmm-client_install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@
debug:
msg: '{{mysql_pmm_user}}'

#- include_tasks: install_mysql_driver.yml
# tags:
# - install_mysql_driver
# when: mysql_pmm_user is not none
#
#- include_tasks: create_mysql_user.yml
# tags:
# - create_mysql_user
# when: mysql_pmm_user != ''
#
#- include_tasks: pmm_add_mysql.yml
# tags:
# - pmm_add_mysql
# when: mysql_pmm_user != ''
- include_tasks: install_mysql_driver.yml
tags:
- install_mysql_driver
when: mysql_pmm_user is not none

- include_tasks: create_mysql_user.yml
tags:
- create_mysql_user
when: mysql_pmm_user != ''

- include_tasks: pmm_add_mongodb.yml
- include_tasks: pmm_add_mysql.yml
tags:
- pmm_add_mongodb
when: pmm_mongo_user != ''
- pmm_add_mysql
when: mysql_pmm_user != ''

#- include_tasks: pmm_add_mongodb.yml
# tags:
# - pmm_add_mongodb
# when:
# - pmm_mongo_user != ''

- import_tasks: copy_pmm_conf.yml
tags:
Expand Down

0 comments on commit ce09c58

Please sign in to comment.