AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

Ansible for Autonomous Industrial Systems: Automate Smart Factories & Supply Chains (2026 Guide)

By Luca Berton · Published 2024-01-01 · Category: troubleshooting

Complete guide to automating autonomous industrial systems with Ansible. Manage smart factory infrastructure, orchestrate robot fleets, deploy predictive.

Factories, logistics networks, and supply chains are becoming semi-autonomous through robotics plus AI orchestration. Deloitte's 2026 report highlights autonomous industrial systems as a defining trend, with robot fleets and self-driving production flows transforming manufacturing. Ansible manages the IT/OT infrastructure that powers these systems.

Industrial Automation Stack

┌────────────────────────────────────────────┐
│       Enterprise IT (ERP, MES, PLM)        │
├────────────────────────────────────────────┤
│       Edge Computing / AI Inference        │
├────────────────────────────────────────────┤
│       SCADA / Industrial Controllers       │
├────────────────────────────────────────────┤
│       Robot Fleet / AGVs / Conveyors       │
├────────────────────────────────────────────┤
│       Sensors / Actuators / PLCs           │
└────────────────────────────────────────────┘
   ↑ Ansible manages IT and edge layers ↑

See also: Ansible for Physical AI & Robotics: Automate Fleet Management (2026 Guide)

Factory Floor Inventory

# inventory/smart-factory.yml
all:
  children:
    edge_servers:
      hosts:
        edge-line-1: { ansible_host: 10.10.1.1, production_line: "assembly-1" }
        edge-line-2: { ansible_host: 10.10.1.2, production_line: "assembly-2" }
        edge-quality: { ansible_host: 10.10.1.3, production_line: "quality-control" }
      vars:
        gpu_type: "Jetson_AGX_Orin"
        ai_models: ["defect-detection", "anomaly-prediction"]

    mes_servers:
      hosts:
        mes-01: { ansible_host: 10.10.2.1 }
        mes-02: { ansible_host: 10.10.2.2 }
      vars:
        role: "manufacturing_execution"

    scada_gateways:
      hosts:
        scada-gw-01: { ansible_host: 10.10.3.1, protocol: "modbus-tcp" }
        scada-gw-02: { ansible_host: 10.10.3.2, protocol: "opcua" }
      vars:
        ot_network: true
        it_ot_bridge: true

    data_historians:
      hosts:
        historian-01: { ansible_host: 10.10.4.1 }

Deploy Predictive Maintenance AI

- name: Deploy predictive maintenance at edge
  hosts: edge_servers
  become: true
  vars:
    model_version: "2.3.1"
    prediction_interval_seconds: 30

  tasks:
    - name: Deploy predictive maintenance model
      ansible.builtin.get_url:
        url: "{{ model_registry }}/predictive-maintenance/v{{ model_version }}.onnx"
        dest: "/opt/ai-models/predictive-maintenance-v{{ model_version }}.onnx"
        checksum: "sha256:{{ pm_model_checksum }}"

    - name: Update active model
      ansible.builtin.file:
        src: "/opt/ai-models/predictive-maintenance-v{{ model_version }}.onnx"
        dest: /opt/ai-models/current-pm.onnx
        state: link

    - name: Deploy inference service
      ansible.builtin.template:
        src: predictive-maintenance.service.j2
        dest: /etc/systemd/system/predictive-maintenance.service
      notify: restart predictive-maintenance

    - name: Configure prediction parameters
      ansible.builtin.copy:
        content: |
          prediction:
            model_path: /opt/ai-models/current-pm.onnx
            interval_seconds: {{ prediction_interval_seconds }}
            data_sources:
              - type: vibration
                sensor_ids: {{ vibration_sensors | to_nice_yaml }}
                sampling_hz: 1000
              - type: temperature
                sensor_ids: {{ temp_sensors | to_nice_yaml }}
                sampling_hz: 10
              - type: current
                sensor_ids: {{ current_sensors | to_nice_yaml }}
                sampling_hz: 100

            alerts:
              warning_threshold: 0.7
              critical_threshold: 0.9
              alert_endpoint: "http://mes-01:8080/api/maintenance-alert"

            actions:
              on_critical:
                - notify_maintenance_team
                - reduce_machine_speed
                - log_to_historian
        dest: /etc/predictive-maintenance/config.yaml
      notify: restart predictive-maintenance

See also: Red Hat Summit: Connect 2024 – Future of AI, Cloud, & Automation

Quality Control Vision System

- name: Deploy AI quality inspection
  hosts: edge_quality
  become: true
  tasks:
    - name: Deploy defect detection model
      ansible.builtin.copy:
        src: "models/defect-detection-v{{ qc_model_version }}.engine"
        dest: /opt/ai-models/defect-detection.engine

    - name: Deploy quality control service
      community.docker.docker_container:
        name: quality-inspection
        image: "{{ qc_service_image }}"
        state: started
        restart_policy: unless-stopped
        ports:
          - "8080:8080"
        volumes:
          - /opt/ai-models:/models:ro
          - /var/qc-images:/images
        env:
          MODEL_PATH: /models/defect-detection.engine
          CAMERA_URLS: "{{ camera_urls | join(',') }}"
          CONFIDENCE_THRESHOLD: "0.85"
          REJECT_ACTION: "divert_to_rework"
          MES_ENDPOINT: "http://mes-01:8080/api/quality-result"
        device_requests:
          - driver: nvidia
            count: 1
            capabilities: [["gpu"]]

    - name: Configure quality thresholds
      ansible.builtin.copy:
        content: |
          quality:
            defect_classes:
              - name: scratch
                severity: minor
                confidence_threshold: 0.90
              - name: crack
                severity: critical
                confidence_threshold: 0.80
                action: stop_line
              - name: discoloration
                severity: minor
                confidence_threshold: 0.85
              - name: dimensional_error
                severity: major
                confidence_threshold: 0.88
                action: divert_to_rework
            
            reporting:
              batch_size: 100
              report_to: historian
              real_time_dashboard: true
        dest: /etc/quality-control/thresholds.yaml

OT/IT Network Security

- name: Secure OT/IT boundary
  hosts: scada_gateways
  become: true
  tasks:
    - name: Configure IT/OT firewall rules
      ansible.builtin.iptables:
        chain: FORWARD
        source: "{{ it_network_cidr }}"
        destination: "{{ ot_network_cidr }}"
        jump: DROP
        comment: "Block direct IT→OT traffic"

    - name: Allow only authorized IT→OT protocols
      ansible.builtin.iptables:
        chain: FORWARD
        source: "{{ item.source }}"
        destination: "{{ item.dest }}"
        protocol: tcp
        destination_port: "{{ item.port }}"
        jump: ACCEPT
        comment: "{{ item.comment }}"
      loop:
        - { source: "{{ mes_subnet }}", dest: "{{ ot_network_cidr }}", port: "502", comment: "MES→Modbus" }
        - { source: "{{ mes_subnet }}", dest: "{{ ot_network_cidr }}", port: "4840", comment: "MES→OPC UA" }
        - { source: "{{ historian_subnet }}", dest: "{{ ot_network_cidr }}", port: "4840", comment: "Historian→OPC UA" }

    - name: Deploy OT protocol monitoring
      community.docker.docker_container:
        name: ot-monitor
        image: "{{ ot_monitor_image }}"
        state: started
        network_mode: host
        env:
          MONITOR_INTERFACES: "eth0,eth1"
          PROTOCOLS: "modbus,opcua,ethernet-ip"
          ALERT_ENDPOINT: "{{ siem_endpoint }}"
          BASELINE_MODE: "{{ 'learn' if first_deploy else 'enforce' }}"

See also: Ansible for Edge Computing and IoT: Managing Thousands of Distributed Devices

Supply Chain Data Pipeline

- name: Deploy supply chain data integration
  hosts: data_historians
  become: true
  tasks:
    - name: Deploy time-series database for production data
      community.docker.docker_container:
        name: timescaledb
        image: timescale/timescaledb:latest-pg16
        state: started
        restart_policy: unless-stopped
        ports:
          - "5432:5432"
        volumes:
          - /var/lib/timescaledb:/var/lib/postgresql/data
        env:
          POSTGRES_PASSWORD: "{{ vault_historian_password }}"
          POSTGRES_DB: factory_data
      no_log: true

    - name: Configure data retention policies
      community.postgresql.postgresql_query:
        db: factory_data
        query: |
          SELECT add_retention_policy('sensor_data', INTERVAL '90 days');
          SELECT add_retention_policy('production_metrics', INTERVAL '365 days');
          SELECT add_retention_policy('quality_results', INTERVAL '2555 days');
        login_password: "{{ vault_historian_password }}"
      no_log: true

    - name: Deploy data pipeline for supply chain analytics
      ansible.builtin.template:
        src: supply-chain-pipeline.yaml.j2
        dest: /etc/data-pipeline/supply-chain.yaml
      vars:
        sources:
          - name: production_output
            type: opcua
            endpoint: "opc.tcp://scada-gw-01:4840"
          - name: quality_results
            type: rest
            endpoint: "http://edge-quality:8080/api/results"
          - name: inventory_levels
            type: modbus
            endpoint: "modbus-tcp://scada-gw-02:502"

FAQ

Can Ansible manage factory floor systems?

Ansible manages the IT and edge computing layers of industrial systems — edge AI servers, SCADA gateways, data historians, MES servers, and network infrastructure. It doesn't directly program PLCs, but it manages everything above the PLC layer.

How does Ansible help with predictive maintenance?

Ansible deploys AI models for predictive maintenance to edge servers near production equipment, configures sensor data collection, sets alert thresholds, and manages model updates with rolling deployments that don't interrupt production.

How do you secure the IT/OT boundary?

Use Ansible to configure firewall rules on IT/OT gateway servers, allowing only authorized protocols (Modbus, OPC UA) from specific subnets. Deploy protocol monitoring containers that detect anomalous OT traffic and alert to your SIEM.

Can Ansible support Industry 4.0 initiatives?

Yes. Ansible provides the infrastructure automation for smart factory components: edge AI deployment, data pipeline configuration, IT/OT security, supply chain integration, and fleet management — all version-controlled and repeatable.

Conclusion

Autonomous industrial systems in 2026 depend on reliable, secure, and well-managed IT infrastructure. Ansible automates the deployment of edge AI for predictive maintenance and quality control, secures IT/OT boundaries, manages data pipelines for supply chain analytics, and ensures production systems are consistently configured and auditable.

Category: troubleshooting

Browse all Ansible tutorials · AnsiblePilot Home