roles:
- role: ansible-role-postgresql
become: yes
postgresql_enablerepo: "pgdg96"
postgresql_restarted_state: "restarted"
postgresql_python_library: python-psycopg2
postgresql_bin_path: /usr/pgsql-9.6/bin
postgresql_daemon: postgresql-9.6.service
TASK [ansible-role-postgresql : Ensure PostgreSQL databases are present.] ****************************************************************************
failed: [clpaxd-iwh01.na.ad.rrd.com] (item={u'owner': u'manifold', u'login_user': u'manifold', u'name': u'manifoldcf', u'login_password': u'manifold'}) => {"changed": false, "item": {"login_password": "manifold", "login_user": "manifold", "name": "manifoldcf", "owner": "manifold"}, "msg": "the python psycopg2 module is required"}
ํ๊ฒฝ:
์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ด๋์ด๊ฐ ์์ต๋๊น?
pip install -U --no-cache-dir --force psycopg2
์๋
์ด ๋ฒ๊ทธ๋ no_log
๊ฐ ์ฌ์ฉ์๋ฅผ ์์ฑํ์ฌ ์ค์ ๋ฌธ์ ๋ฅผ ์ํํ๋ ๊ฒฝ์ฐ์ ๋ฐ์ํ๋ ๊ฒฝ์ฐ์ ์ฌ์ฉ๋๊ธฐ ๋๋ฌธ์ ์์๋ด๊ธฐ๊ฐ ์ฝ๊ฐ ์ฑ๊ฐ์ญ๋๋ค.
๋๋ ๊ฐ์ธ์ ์ผ๋ก ์ฌ์ฉํ์ฌ ๊ณ ์ package
์ค์นํ๊ธฐ python3-psycopg2
Postgres์ ์ญํ ์ ๊ฐ์ ธ ์ค๊ธฐ ์ ์.
Ubuntu์์ ์ค๋๋ ์ค๋ ๋(๊ทธ๋ฌ๋ ์ด๋ ค ์์)์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. no_log๋ฅผ ์ ๊ฑฐํ๋ฉด ํจํค์ง ๋๋ฝ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๋ํ๋ฉ๋๋ค. ์๋ ์ค์น psycopg2 ํ ์ฌ์ฉ์ ์์ ์ด ์๋ํฉ๋๋ค. ํ์ python ํจํค์ง๋ฅผ ์ค์นํ๊ธฐ ์ํ ์ถ๊ฐ ๋จ๊ณ๋ก ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ฉ๋๋ค.
์ด๋ฏธ python3-psycopg2๋ฅผ ์ค์นํ์ง๋ง ์ฌ์ ํ ์คํจํ์ต๋๋ค.
postgresql_python_library: python3-psycopg2
๊ทธ๋์ ๋ด ํ๋ ์ด๋ถ์ ๋ค์์ ์ถ๊ฐํ์ต๋๋ค.
sible_python_interpreter: /usr/bin/python3
๊ธฐ๋ณธ์ ์ผ๋ก /usr/bin/python์ ์ฌ์ฉํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฐ๋น์ 10์์;
/usr/bin/python --๋ฒ์
ํ์ด์ฌ 2.7.16
์ด ๋ฌธ์ ๋ ์ต๊ทผ ํ๋ ๋ถ์กฑ์ผ๋ก ์ธํด '๋ถ์ค'๋ก ํ์๋์์ต๋๋ค. ๋ ์ด์ ํ๋์ด ์์ผ๋ฉด 30์ผ ํ์ ๋ฌธ์ ๊ฐ ์ข ๋ฃ๋ฉ๋๋ค. ๋น์ ์ ๊ธฐ์ฌ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
์ด ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ ์ ์ฝ๊ณ ๋ฌธ์ ๋ฅผ ์ค๋๋ ๊ฒ์ผ๋ก ํ์ํ๋ ์ด์ ๋ฅผ ํ์ธํ์ญ์์ค.
์ด ๋ฌธ์ ๋ ํ๋์ด ์์ด ์ข ๋ฃ๋์์ต๋๋ค. ์ด๊ฒ์ด ์ค๋ฅ๋ผ๊ณ ์๊ฐ๋๋ฉด ๋ฌธ์ ๋ฅผ ๋ค์ ์ด๊ฑฐ๋ ๊ด๋ จ ์ธ๋ถ ์ ๋ณด๋ก ์ ๋ฌธ์ ๋ฅผ ์ ์ถํ์ญ์์ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ด๋ฏธ python3-psycopg2๋ฅผ ์ค์นํ์ง๋ง ์ฌ์ ํ ์คํจํ์ต๋๋ค.
postgresql_python_library: python3-psycopg2
๊ทธ๋์ ๋ด ํ๋ ์ด๋ถ์ ๋ค์์ ์ถ๊ฐํ์ต๋๋ค.
sible_python_interpreter: /usr/bin/python3
๊ธฐ๋ณธ์ ์ผ๋ก /usr/bin/python์ ์ฌ์ฉํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฐ๋น์ 10์์;
/usr/bin/python --๋ฒ์
ํ์ด์ฌ 2.7.16