Skip to content

Commit

Permalink
Skip python2 installation when specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre MORVAN committed Oct 2, 2023
1 parent 86686e2 commit 18e687b
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 10 deletions.
10 changes: 5 additions & 5 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python2 sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash iproute2 && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash iproute2 && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python2 sudo bash ca-certificates iproute2; fi
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && which python 2>&1 1>/dev/null || apt-get install -y python2 && apt-get install -y sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && which python 2>&1 1>/dev/null || dnf --assumeyes install python python-devel python2-dnf && dnf --assumeyes install sudo bash iproute2 && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && which python 2>&1 1>/dev/null || yum install -y python && yum install -y sudo yum-plugin-ovl bash iproute2 && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && which python 2>&1 1>/dev/null || zypper install -y python python-xml && zypper install -y sudo bash iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && which python 2>&1 1>/dev/null || apk add --no-cache python2 && apk add --no-cache sudo bash ca-certificates iproute2; fi
76 changes: 76 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,80 @@ platforms:
- ${MOLECULE_SCENARIO_DIRECTORY}/tls:/opt/kafka/tls
groups:
- kafka
- name: kafka1-351
hostname: kafka1-351
image: ryarnyah/kafka:2.13-3.5.1
command: "start-kafka.sh"
env:
HOSTNAME_COMMAND: "hostname -i | cut -d' ' -f1"
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://_{HOSTNAME_COMMAND}:9092,SASL_PLAINTEXT://_{HOSTNAME_COMMAND}:9094,SASL_SSL://_{HOSTNAME_COMMAND}:9095,SSL://_{HOSTNAME_COMMAND}:9096
KAFKA_LISTENERS: PLAINTEXT://:9092,SASL_PLAINTEXT://:9094,SASL_SSL://:9095,SSL://:9096,KRAFT://:9091
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL,SSL:SSL,KRAFT:PLAINTEXT
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_NODE_ID: "1"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka1-351:9091,2@kafka2-351:9091"
KAFKA_CONTROLLER_LISTENER_NAMES: "KRAFT"
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
KAFKA_SUPER_USERS: User:admin
KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
KAFKA_OPTS: -Djava.security.auth.login.config=/opt/kafka/jaas/kafka_server_jaas.conf
KAFKA_SSL_KEYSTORE_LOCATION: /opt/kafka/tls/keystore/server-keystore.jks
KAFKA_SSL_KEYSTORE_PASSWORD: password
KAFKA_SSL_KEY_PASSWORD: password
KAFKA_SSL_TRUSTSTORE_LOCATION: /opt/kafka/tls/keystore/server-truststore.jks
KAFKA_SSL_TRUSTSTORE_PASSWORD: password
KAFKA_SSL_CLIENT_AUTH: required
published_ports:
- "9092"
networks:
- name: molecule
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${MOLECULE_SCENARIO_DIRECTORY}/kafka_server_jaas.conf:/opt/kafka/jaas/kafka_server_jaas.conf
- ${MOLECULE_SCENARIO_DIRECTORY}/tls:/opt/kafka/tls
groups:
- kafka
- name: kafka2-351
hostname: kafka2-351
image: ryarnyah/kafka:2.13-3.5.1
command: "start-kafka.sh"
env:
HOSTNAME_COMMAND: "hostname -i | cut -d' ' -f1"
KAFKA_DELETE_TOPIC_ENABLE: "true"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://_{HOSTNAME_COMMAND}:9092,SASL_PLAINTEXT://_{HOSTNAME_COMMAND}:9094,SASL_SSL://_{HOSTNAME_COMMAND}:9095,SSL://_{HOSTNAME_COMMAND}:9096
KAFKA_LISTENERS: PLAINTEXT://:9092,SASL_PLAINTEXT://:9094,SASL_SSL://:9095,SSL://:9096,KRAFT://:9091
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL,SSL:SSL,KRAFT:PLAINTEXT
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_NODE_ID: "1"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka1-351:9091,2@kafka2-351:9091"
KAFKA_CONTROLLER_LISTENER_NAMES: "KRAFT"
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
KAFKA_SUPER_USERS: User:admin
KAFKA_SASL_ENABLED_MECHANISMS: PLAIN
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
KAFKA_OPTS: -Djava.security.auth.login.config=/opt/kafka/jaas/kafka_server_jaas.conf
KAFKA_SSL_KEYSTORE_LOCATION: /opt/kafka/tls/keystore/server-keystore.jks
KAFKA_SSL_KEYSTORE_PASSWORD: password
KAFKA_SSL_KEY_PASSWORD: password
KAFKA_SSL_TRUSTSTORE_LOCATION: /opt/kafka/tls/keystore/server-truststore.jks
KAFKA_SSL_TRUSTSTORE_PASSWORD: password
KAFKA_SSL_CLIENT_AUTH: required
published_ports:
- "9092"
networks:
- name: molecule
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${MOLECULE_SCENARIO_DIRECTORY}/kafka_server_jaas.conf:/opt/kafka/jaas/kafka_server_jaas.conf
- ${MOLECULE_SCENARIO_DIRECTORY}/tls:/opt/kafka/tls
groups:
- kafka
provisioner:
name: ansible
config_options:
Expand All @@ -393,6 +467,8 @@ provisioner:
- protocol_version: "3.4.0"
instance_suffix: "340"
zk_tls: true
- protocol_version: "3.5.1"
instance_suffix: "351"
topic_defaut_configuration:
state: 'present'
replica_factor: 1
Expand Down
10 changes: 5 additions & 5 deletions molecule/scram-kafka-270/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ FROM {{ item.registry.url }}/{{ item.image }}
FROM {{ item.image }}
{% endif %}

RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python2 sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash iproute2 && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash iproute2 && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python2 sudo bash ca-certificates iproute2; fi
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && which python 2>&1 1>/dev/null || apt-get install -y python2 && apt-get install -y sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && which python 2>&1 1>/dev/null || dnf --assumeyes install python python-devel python2-dnf && dnf --assumeyes install sudo bash iproute2 && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && which python 2>&1 1>/dev/null || yum install -y python && yum install -y sudo yum-plugin-ovl bash iproute2 && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && which python 2>&1 1>/dev/null || zypper install -y python python-xml && zypper install -y sudo bash iproute2 && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && which python 2>&1 1>/dev/null || apk add --no-cache python2 && apk add --no-cache sudo bash ca-certificates iproute2; fi

0 comments on commit 18e687b

Please sign in to comment.