initial commit

Signed-off-by: Marc Ahlgrim <marc@onemarcfifty.com>
This commit is contained in:
Marc Ahlgrim 2022-08-02 16:35:35 +02:00
parent 90e2e87524
commit 5473938286
4 changed files with 79 additions and 0 deletions

View File

@ -1,2 +1,3 @@
# ansible-rundeck
Scripts and Dockerfile for creation of an ansible host with rundeck

View File

@ -0,0 +1,23 @@
FROM rundeck/rundeck:4.4.0
# minimal rundeck with ansible
# no mariadb
USER root
RUN apt-get -y update && \
apt-get -y install \
apt-transport-https \
python3-pip
RUN pip install --upgrade pip
RUN pip install ansible
USER rundeck
#VOLUME ["/home/rundeck/server/data"]
#EXPOSE 4440
#ENTRYPOINT [ "docker-lib/entry.sh" ]

View File

@ -0,0 +1,14 @@
# rundeck-ansible
version: '3'
services:
rundeck:
build: .
container_name: rundeck
restart: on-failure:5
environment:
RUNDECK_GRAILS_URL: http://127.0.0.1:4440
ports:
- 4440:4440

View File

@ -0,0 +1,41 @@
#!/bin/bash
# this script installs ansible and rundeck on a
# vanilla debian 11
# RUN AS ROOT!
apt update
apt -y upgrade
apt install -y python3 pip sudo wget curl
useradd -m -G sudo -s /bin/bash rundeck
# passwd rundeck
pip install ansible
curl https://raw.githubusercontent.com/rundeck/packaging/main/scripts/deb-setup.sh 2> /dev/null | sudo bash -s rundeck
apt update
apt -y install rundeck
sed -i s/localhost/`hostname`/g /etc/rundeck/framework.properties
sed -i s/localhost/`hostname`/g /etc/rundeck/rundeck-config.properties
# optional: move to mariadb
# install mariadb
apt install -y mariadb-server
# create rundeck db
mysql -u root -e 'create database rundeck'
# create user, random pass and grant access
RANDOMPASSWORD=`date +%s | sha256sum | base64 | head -c 32`
mysql -u root -e "create user rundeck@localhost identified by '$RANDOMPASSWORD'"
mysql -u root -e 'grant ALL on rundeck.* to rundeck@localhost'
# update the rundeck config
sed -i s/^dataSource.url/\#dataSource.url/g /etc/rundeck/rundeck-config.properties
echo 'dataSource.driverClassName = org.mariadb.jdbc.Driver'>>/etc/rundeck/rundeck-config.properties
echo 'dataSource.url = jdbc:mysql://localhost/rundeck?autoReconnect=true&useSSL=false' >>/etc/rundeck/rundeck-config.properties
echo 'dataSource.username = rundeck' >>/etc/rundeck/rundeck-config.properties
echo "dataSource.password = $RANDOMPASSWORD" >>/etc/rundeck/rundeck-config.properties
RANDOMPASSWORD="nothing here"
# start rundeck services
/etc/init.d/rundeckd start
systemctl enable rundeckd