How to connect into remote server:
in your client do:
from the terminal type: ssh-keygen
and complete the steps
which creates id_rsa
and id_rsa.pub
files in ~/.ssh/
directory
do cat ~/.ssh/id_rsa.pub
copy
everything
login to remote server
paste
the text in ~/.ssh/authorized_keys
Do login via: ssh ec2-user@< public ip >
docker ps -a
docker run -d --name tomcat-container -p 8081:8080 tomcat
-d : detached
--name tomcat-container : name of the container is tomcat-container
-p 8081:8080 : port inside 8080, external network
tomcat : name of the image (done by docker pull)
docker exec -it tomcat-container /bin/bash
exec : Execute a command in a running container
-i, --interactive Keep STDIN open even if not attached
--privileged Give extended privileges to the command
-t, --tty Allocate a pseudo-TTY
docker stop <container-name>
cd ~
touch Dockerfile
inside Dockerfile
:
FROM fedora:latest
RUN yum install java -y
RUN mkdir /opt/tomcat
WORKDIR /opt/tomcat
ADD https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.19/bin/apache-tomcat-10.1.19.tar.gz .
RUN tar -xvzf apache-tomcat-10.1.19.tar.gz
RUN mv apache-tomcat-10.1.19 tomcat
EXPOSE 8080
CMD ["/opt/tomcat/bin/catalina.sh", "run"]
docker build -t mytomcat .
docker rm <container name>
docker container prune
docker image prune -a
ansible all --list-hosts
ansible all -m gather_facts
collects and shows all the informations like procssor, memory, all of your env varibles and more
ansible all -m gather_facts --limit
<ipAddr>
limit with one ip address
ansible all -m apt -a update_cache=true --become --ask-become-pass
after this enter a sudo passwd of the local system it will give this response
ansible all -m apt -a name=vim-nox --become --ask-become-pass
ansible all -m apt -a "name=openssl state=latest" --become --ask-become-pass
from the above code, we are updating openssl
package
ansible all -m apt -a "upgrade=dist" --become --ask-become-pass
ansible-playbook --ask-become-pass install_apache.yml
sudo firewall-cmd --add-port=80/tcp
ansible-playbook --list-tags site.yml
ansible-playbook --tags centos --ask-become-pass site.yml
mutliple tags:
ansible-playbook --tags "db, apache" --ask-become-pass site.yml