備忘録/にわかエンジニアが好きなように書く

個人的にとりあえず仕組みを知るために、触りたように好きにとりあえず動くような構築してみる 個人用の備忘録となるので内容の保証はないのでその点はご了承ください。 ※変な内容や間違いを書いているなどありましたらコメントやご指摘いただけると幸いです。

Ansible AWX をインストール

 

事前準備

パッケージ更新

[root@ansible ~]# yum -y update

Dockerインストール

インストール
[root@ansible ~]# yum install -y docker
 バージョン確認
[root@ansible ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@ansible ~]# docker -v
Docker version 1.13.1, build 774336d/1.13.1
[root@ansible ~]#
起動設定
[root@ansible ~]# systemctl start docker
[root@ansible ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@ansible ~]#

AWXインストール

パッケージ追加

必要パッケージのインストール①(Git)
[root@ansible ~]# yum install -y git
必要パッケージのインストール②(docker-python)
[root@ansible ~]# yum install -y docker-python
必要パッケージのインストール③(ansible)
[root@ansible ~]# yum install -y ansible

AWXインストール

ファイル取得
[root@ansible ~]# git clone https://github.com/ansible/awx.git
Cloning into 'awx'...
remote: Counting objects: 161496, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 161496 (delta 17), reused 34 (delta 17), pack-reused 161456
Receiving objects: 100% (161496/161496), 194.27 MiB | 13.14 MiB/s, done.
Resolving deltas: 100% (124566/124566), done.
[root@ansible ~]#
[root@ansible ~]# cd awx/installer/
[root@ansible installer]# pwd
/root/awx/installer
[root@ansible installer]#
PlayBookの実行(AWXインストール)
[root@ansible installer]# ansible-playbook -i inventory install.yml

~ 省略 ~

TASK [local_docker : Activate AWX Web Container] ***************************************************************
changed: [localhost]

TASK [local_docker : Activate AWX Task Container] **************************************************************
changed: [localhost]

TASK [local_docker : Create /var/lib/awx directory] ************************************************************
skipping: [localhost]

TASK [local_docker : Create docker-compose.yml file] ***********************************************************
skipping: [localhost]

TASK [local_docker : Start the containers] *********************************************************************
skipping: [localhost]

PLAY RECAP *****************************************************************************************************
localhost : ok=12 changed=5 unreachable=0 failed=0

[root@ansible installer]#
コンテナ起動確認
[root@ansible installer]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/ansible/awx_task latest a48760415f05 6 hours ago 1.01 GB
docker.io/ansible/awx_web latest f17694b11e5e 6 hours ago 982 MB
docker.io/memcached alpine 44e151ee7837 9 days ago 7.88 MB
docker.io/ansible/awx_rabbitmq 3.7.4 e08fe791079e 12 days ago 85.6 MB
docker.io/postgres 9.6 ee7bf928a9ff 3 weeks ago 266 MB
[root@ansible installer]#
[root@ansible installer]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
85cab340d60b ansible/awx_task:latest "/tini -- /bin/sh ..." 2 minutes ago Up 2 minutes 8052/tcp awx_task
184fb5d0b698 ansible/awx_web:latest "/tini -- /bin/sh ..." 3 minutes ago Up 3 minutes 0.0.0.0:80->8052/tcp awx_web
6906570b1326 memcached:alpine "docker-entrypoint..." 4 minutes ago Up 4 minutes 11211/tcp memcached
9f463fab632f ansible/awx_rabbitmq:3.7.4 "docker-entrypoint..." 4 minutes ago Up 4 minutes 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp rabbitmq
4bc6d1d08bd8 postgres:9.6 "docker-entrypoint..." 4 minutes ago Up 4 minutes 5432/tcp

 

AWXへGUIログイン

1.ブラウザでアクセス (最初から日本語表示となっている)

   URL:http://[AWXのホストアドレス] 
2.ユーザ名: admin パスワード: password

3.サインインをクリック

f:id:pocket01:20180409190858p:plain

■ログイン後のダッシュボード

f:id:pocket01:20180409191136p:plain

 

※参考※実行ファイル"inventory"の内容(デフォルト)

内容から初期ユーザ名/パスワード情報などが分かる

[root@ansible installer]# cat inventory
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"

[all:vars]

# Remove these lines if you want to run a local image build
# Otherwise the setup playbook will install the official Ansible images. Versions may
# be selected based on: latest, 1, 1.0, 1.0.0, 1.0.0.123
# by default the base will be used to search for ansible/awx_web and ansible/awx_task
dockerhub_base=ansible
dockerhub_version=latest

# Openshift Install
# Will need to set -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)
# openshift_host=127.0.0.1:8443
# awx_openshift_project=awx
# openshift_user=developer
# awx_node_port=30083

# Kubernetes Install
# kubernetes_context=test-cluster
# awx_kubernetes_namespace=awx

# Kubernetes and Openshift Install Resource Requests
# This is the request value for a pod's "task" container, which is the container
# used to run jobs. The other containers have a fixed resource request. The total amount
# of requested resources for a pod is the sum of all resources requested by all containers
# in the pod
# A cpu_request of 1500 is 1.5 cores for the task container
# A mem_request of 2 is for 2 gigabytes of memory for the task container
# awx_task_cpu_request=1500
# awx_task_mem_request=2

# Common Docker parameters
postgres_data_dir=/tmp/pgdocker
host_port=80

# Docker Compose Install
# use_docker_compose=false
# The docker_compose.yml file will be created in this directory
# The name of the directory (here "awx") will be the prefix of the docker containers
docker_compose_dir=/var/lib/awx

# Required for Openshift when building the image on your own
# Optional for Openshift if using Dockerhub or another prebuilt registry
# Required for Standalone Docker Install if building the image on your own
# Optional for Standalone Docker Install if using Dockerhub or another prebuilt registry
# Required for Docker Compose Install if building the image on your own
# Optional for Docker Compose Install if using Dockerhub or another prebuilt registry
# Define if you want the image pushed to a registry. The container definition will also use these images
# docker_registry=172.30.1.1:5000
# docker_registry_repository=awx
# docker_registry_username=developer

# Docker_image will not attempt to push to remote if the image already exists locally
# Set this to true to delete images from docker on the build host so that they are pushed to the remote repository
# docker_remove_local_images=False

# Set pg_hostname if you have an external postgres server, otherwise
# a new postgres service will be created
# pg_hostname=postgresql
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432

# Use a local distribution build container image for building the AWX package
# This is helpful if you don't want to bother installing the build-time dependencies as
# it is taken care of already.
# NOTE: IMPORTANT: If you are running a mininshift install, using this container might not work
# if you are using certain drivers like KVM where the source tree can't be mapped
# into the build container.
# Thus this setting must be set to False which will trigger a local build. To view the
# typical dependencies that you might need to install see:
# installer/image_build/files/Dockerfile.sdist
# use_container_for_build=true

# This will create or update a default admin (superuser) account in AWX, if not provided
# then these default values are used
# default_admin_user=admin
# default_admin_password=password

# AWX Secret key
# It's *very* important that this stay the same between upgrades or you will lose the ability to decrypt
# your credentials
awx_secret_key=awxsecret

# Build AWX with official logos
# Requires cloning awx-logos repo into the project root.
# Review the trademark guidelines at https://github.com/ansible/awx-logos/blob/master/TRADEMARKS.md
# awx_official=false

# Proxy
#http_proxy=http://proxy:3128
#https_proxy=http://proxy:3128
#no_proxy=mycorp.org

# Container networking configuration
# Set the awx_task and awx_web containers' search domain(s)
#awx_container_search_domains=example.com,ansible.com
# Alternate DNS servers
#awx_alternate_dns_servers="10.1.2.3,10.2.3.4"

# AWX project data folder. If you need access to the location where AWX stores the projects
# it manages from the docker host, you can set this to turn it into a volume for the container.
#project_data_dir=/var/lib/awx/projects

# CA Trust directory. If you need to provide custom CA certificates, supplying
# this variable causes this directory on the host to be bind mounted over
# /etc/pki/ca-trust in the awx_task and awx_web containers.
# NOTE: only obeyed in local_docker install
#ca_trust_dir=/etc/pki/ca-trust
[root@ansible installer]#