Last active
July 27, 2017 07:23
-
-
Save umidjons/4d735e5301fff5dfd6df25c8ca8a4346 to your computer and use it in GitHub Desktop.
Docker container to test moodle existance with ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
SHELL ["/bin/bash", "-c"] | |
# Installing openssh-server, apache, php and moodle | |
RUN set -x \ | |
&& apt-get update \ | |
&& DEBIAN_FRONTEND=noninteractive apt-get install -q -y --fix-missing apache2 php5 wget openssh-server \ | |
&& cd /tmp \ | |
&& wget --continue --tries=100 --waitretry=1 --timeout=10 -O moodle-latest-32.tgz https://download.moodle.org/stable32/moodle-latest-32.tgz \ | |
&& tar -xzf moodle-latest-32.tgz \ | |
&& rm -f moodle-latest-32.tgz \ | |
&& mv moodle /var/www/ \ | |
&& a2dissite 000-default \ | |
&& echo '<VirtualHost _default_:80>\n\ | |
DocumentRoot "/var/www/moodle"\n\ | |
<Directory "/var/www/moodle">\n\ | |
Options Indexes FollowSymLinks\n\ | |
AllowOverride All\n\ | |
Require all granted\n\ | |
</Directory>\n\ | |
</VirtualHost>\n' >> /etc/apache2/sites-available/moodle.conf \ | |
&& a2ensite moodle \ | |
&& echo "root:root@123" | chpasswd \ | |
&& sed -ri -e 's|(^PermitRootLogin )(.*)|\1yes|g' /etc/ssh/sshd_config \ | |
&& mkdir -p /var/run/sshd | |
EXPOSE 22 | |
CMD ["/usr/sbin/sshd", "-D"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ec2instances] | |
# replace 172.17.0.2 with your container's IP | |
test_moodle ansible_ssh_host=172.17.0.2 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass=root@123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build container with:
docker build -t test_moodle .
Then run it:
Check ssh with:
Then run the discovery task using above hosts file: